src/HOL/Homology/Simplices.thy
author desharna
Thu, 08 Jul 2021 08:42:36 +0200
changeset 73932 fd21b4a93043
parent 73655 26a1d66b9077
child 73933 fa92bc604c59
permissions -rw-r--r--
added opaque_combs and renamed hide_lams to opaque_lifting
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     1
section\<open>Homology, I: Simplices\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     2
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     3
theory "Simplices"
71200
3548d54ce3ee split off metric spaces part of Function_Topology: subsequent theories Product_Topology, T1_Spaces, Lindelof_Spaces are purely topological
immler
parents: 70817
diff changeset
     4
  imports
3548d54ce3ee split off metric spaces part of Function_Topology: subsequent theories Product_Topology, T1_Spaces, Lindelof_Spaces are purely topological
immler
parents: 70817
diff changeset
     5
    "HOL-Analysis.Function_Metric"
3548d54ce3ee split off metric spaces part of Function_Topology: subsequent theories Product_Topology, T1_Spaces, Lindelof_Spaces are purely topological
immler
parents: 70817
diff changeset
     6
    "HOL-Analysis.Abstract_Euclidean_Space"
3548d54ce3ee split off metric spaces part of Function_Topology: subsequent theories Product_Topology, T1_Spaces, Lindelof_Spaces are purely topological
immler
parents: 70817
diff changeset
     7
    "HOL-Algebra.Free_Abelian_Groups"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     8
begin
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
     9
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    10
subsection\<open>Standard simplices, all of which are topological subspaces of @{text"R^n"}.      \<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    11
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    12
type_synonym 'a chain = "((nat \<Rightarrow> real) \<Rightarrow> 'a) \<Rightarrow>\<^sub>0 int"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    13
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
definition standard_simplex :: "nat \<Rightarrow> (nat \<Rightarrow> real) set" where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    15
  "standard_simplex p \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    16
    {x. (\<forall>i. 0 \<le> x i \<and> x i \<le> 1) \<and> (\<forall>i>p. x i = 0) \<and> (\<Sum>i\<le>p. x i) = 1}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    17
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    18
lemma topspace_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
  "topspace(subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    20
    = standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    21
  by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    22
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    23
lemma basis_in_standard_simplex [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    24
   "(\<lambda>j. if j = i then 1 else 0) \<in> standard_simplex p \<longleftrightarrow> i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    25
  by (auto simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    26
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    27
lemma nonempty_standard_simplex: "standard_simplex p \<noteq> {}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    28
  using basis_in_standard_simplex by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    29
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    30
lemma standard_simplex_0: "standard_simplex 0 = {(\<lambda>j. if j = 0 then 1 else 0)}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    31
  by (auto simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    32
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    33
lemma standard_simplex_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    34
  assumes "p \<le> q"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    35
  shows "standard_simplex p \<subseteq> standard_simplex q"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    36
  using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    37
proof (clarsimp simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    38
  fix x :: "nat \<Rightarrow> real"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    39
  assume "\<forall>i. 0 \<le> x i \<and> x i \<le> 1" and "\<forall>i>p. x i = 0" and "sum x {..p} = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    40
  then show "sum x {..q} = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    41
    using sum.mono_neutral_left [of "{..q}" "{..p}" x] assms by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    42
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    43
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    44
lemma closedin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    45
   "closedin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    46
    (is "closedin ?X ?S")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    47
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    48
  have eq: "standard_simplex p =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    49
              (\<Inter>i. {x. x \<in> topspace ?X \<and> x i \<in> {0..1}}) \<inter>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    50
              (\<Inter>i \<in> {p<..}. {x \<in> topspace ?X. x i \<in> {0}}) \<inter>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    51
              {x \<in> topspace ?X. (\<Sum>i\<le>p. x i) \<in> {1}}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    52
    by (auto simp: standard_simplex_def topspace_product_topology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    53
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    54
    unfolding eq
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    55
    by (rule closedin_Int closedin_Inter continuous_map_sum
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    56
             continuous_map_product_projection closedin_continuous_map_preimage | force | clarify)+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    57
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    58
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    59
lemma standard_simplex_01: "standard_simplex p \<subseteq> UNIV \<rightarrow>\<^sub>E {0..1}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    60
  using standard_simplex_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    61
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    62
lemma compactin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    63
   "compactin (powertop_real UNIV) (standard_simplex p)"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    64
proof (rule closed_compactin)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    65
  show "compactin (powertop_real UNIV) (UNIV \<rightarrow>\<^sub>E {0..1})"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    66
    by (simp add: compactin_PiE)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    67
  show "standard_simplex p \<subseteq> UNIV \<rightarrow>\<^sub>E {0..1}"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    68
    by (simp add: standard_simplex_01)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    69
  show "closedin (powertop_real UNIV) (standard_simplex p)"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    70
    by (simp add: closedin_standard_simplex)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    71
qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    72
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    73
lemma convex_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    74
   "\<lbrakk>x \<in> standard_simplex p; y \<in> standard_simplex p;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    75
     0 \<le> u; u \<le> 1\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    76
    \<Longrightarrow> (\<lambda>i. (1 - u) * x i + u * y i) \<in> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    77
  by (simp add: standard_simplex_def sum.distrib convex_bound_le flip: sum_distrib_left)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    78
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    79
lemma path_connectedin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    80
   "path_connectedin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    81
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    82
  define g where "g \<equiv> \<lambda>x y::nat\<Rightarrow>real. \<lambda>u i. (1 - u) * x i + u * y i"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    83
  have "continuous_map
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    84
                (subtopology euclideanreal {0..1}) (powertop_real UNIV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    85
                (g x y)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    86
    if "x \<in> standard_simplex p" "y \<in> standard_simplex p" for x y
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    87
    unfolding g_def continuous_map_componentwise
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    88
    by (force intro: continuous_intros)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    89
  moreover
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    90
  have "g x y ` {0..1} \<subseteq> standard_simplex p" "g x y 0 = x" "g x y 1 = y"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    91
    if "x \<in> standard_simplex p" "y \<in> standard_simplex p" for x y
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    92
    using that by (auto simp: convex_standard_simplex g_def)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    93
  ultimately
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    94
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    95
    unfolding path_connectedin_def path_connected_space_def pathin_def
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
    96
    by (metis continuous_map_in_subtopology euclidean_product_topology top_greatest topspace_euclidean topspace_euclidean_subtopology)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    97
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    98
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    99
lemma connectedin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   100
   "connectedin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   101
  by (simp add: path_connectedin_imp_connectedin path_connectedin_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   102
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   103
subsection\<open>Face map\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   105
definition simplical_face :: "nat \<Rightarrow> (nat \<Rightarrow> 'a) \<Rightarrow> nat \<Rightarrow> 'a::comm_monoid_add" where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   106
   "simplical_face k x \<equiv> \<lambda>i. if i < k then x i else if i = k then 0 else x(i -1)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   107
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   108
lemma simplical_face_in_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   109
  assumes "1 \<le> p" "k \<le> p" "x \<in> standard_simplex (p - Suc 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   110
  shows "(simplical_face k x) \<in> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   111
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   112
  have x01: "\<And>i. 0 \<le> x i \<and> x i \<le> 1" and sumx: "sum x {..p - Suc 0} = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   113
    using assms by (auto simp: standard_simplex_def simplical_face_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   114
  have gg: "\<And>g. sum g {..p} = sum g {..<k} + sum g {k..p}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   115
    using \<open>k \<le> p\<close> sum.union_disjoint [of "{..<k}" "{k..p}"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
    by (force simp: ivl_disj_un ivl_disj_int)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   117
  have eq: "(\<Sum>i\<le>p. if i < k then x i else if i = k then 0 else x (i -1))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   118
         = (\<Sum>i < k. x i) + (\<Sum>i \<in> {k..p}. if i = k then 0 else x (i -1))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   119
    by (simp add: gg)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   120
  consider "k \<le> p - Suc 0" | "k = p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   121
    using \<open>k \<le> p\<close> by linarith
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   122
  then have "(\<Sum>i\<le>p. if i < k then x i else if i = k then 0 else x (i -1)) = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   123
  proof cases
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   124
    case 1
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   125
    have [simp]: "Suc (p - Suc 0) = p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   126
      using \<open>1 \<le> p\<close> by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   127
    have "(\<Sum>i = k..p. if i = k then 0 else x (i -1)) = (\<Sum>i = k+1..p. if i = k then 0 else x (i -1))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   128
      by (rule sum.mono_neutral_right) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   129
    also have "\<dots> = (\<Sum>i = k+1..p. x (i -1))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   130
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   131
    also have "\<dots> = (\<Sum>i = k..p-1. x i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   132
      using sum.atLeastAtMost_reindex [of Suc k "p-1" "\<lambda>i. x (i - Suc 0)"] 1 by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   133
    finally have eq2: "(\<Sum>i = k..p. if i = k then 0 else x (i -1)) = (\<Sum>i = k..p-1. x i)" .
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   134
    with 1 show ?thesis 
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   135
      by (metis (no_types, lifting) One_nat_def eq finite_atLeastAtMost finite_lessThan ivl_disj_int(4) ivl_disj_un(10) sum.union_disjoint sumx)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   136
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   137
    case 2
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   138
    have [simp]: "({..p} \<inter> {x. x < p}) = {..p - Suc 0}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   139
      using assms by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   140
    have "(\<Sum>i\<le>p. if i < p then x i else if i = k then 0 else x (i -1)) = (\<Sum>i\<le>p. if i < p then x i else 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   141
      by (rule sum.cong) (auto simp: 2)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   142
    also have "\<dots> = sum x {..p-1}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   143
      by (simp add: sum.If_cases)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   144
    also have "\<dots> = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   145
      by (simp add: sumx)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   146
    finally show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   147
      using 2 by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   148
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   149
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   150
    using assms by (auto simp: standard_simplex_def simplical_face_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   151
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   152
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   153
subsection\<open>Singular simplices, forcing canonicity outside the intended domain\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   154
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   155
definition singular_simplex :: "nat \<Rightarrow> 'a topology \<Rightarrow> ((nat \<Rightarrow> real) \<Rightarrow> 'a) \<Rightarrow> bool" where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   156
 "singular_simplex p X f \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   157
      continuous_map(subtopology (powertop_real UNIV) (standard_simplex p)) X f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   158
    \<and> f \<in> extensional (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   159
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   160
abbreviation singular_simplex_set :: "nat \<Rightarrow> 'a topology \<Rightarrow> ((nat \<Rightarrow> real) \<Rightarrow> 'a) set" where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   161
 "singular_simplex_set p X \<equiv> Collect (singular_simplex p X)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   162
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   163
lemma singular_simplex_empty:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   164
   "topspace X = {} \<Longrightarrow> \<not> singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   165
  by (simp add: singular_simplex_def continuous_map nonempty_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   167
lemma singular_simplex_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   168
   "\<lbrakk>singular_simplex p (subtopology X T) f; T \<subseteq> S\<rbrakk> \<Longrightarrow> singular_simplex p (subtopology X S) f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
  by (auto simp: singular_simplex_def continuous_map_in_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   170
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   171
lemma singular_simplex_subtopology:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   172
   "singular_simplex p (subtopology X S) f \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   173
        singular_simplex p X f \<and> f ` (standard_simplex p) \<subseteq> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   174
  by (auto simp: singular_simplex_def continuous_map_in_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   175
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   176
subsubsection\<open>Singular face\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   177
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   178
definition singular_face :: "nat \<Rightarrow> nat \<Rightarrow> ((nat \<Rightarrow> real) \<Rightarrow> 'a) \<Rightarrow> (nat \<Rightarrow> real) \<Rightarrow> 'a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
  where "singular_face p k f \<equiv> restrict (f \<circ> simplical_face k) (standard_simplex (p - Suc 0))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   180
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   181
lemma singular_simplex_singular_face:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   182
  assumes f: "singular_simplex p X f" and "1 \<le> p" "k \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   183
  shows "singular_simplex (p - Suc 0) X (singular_face p k f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   185
  let ?PT = "(powertop_real UNIV)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   186
  have 0: "simplical_face k ` standard_simplex (p - Suc 0) \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   187
    using assms simplical_face_in_standard_simplex by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   188
  have 1: "continuous_map (subtopology ?PT (standard_simplex (p - Suc 0)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   189
                          (subtopology ?PT (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   190
                          (simplical_face k)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   191
  proof (clarsimp simp add: continuous_map_in_subtopology simplical_face_in_standard_simplex continuous_map_componentwise 0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   192
    fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   193
    have "continuous_map ?PT euclideanreal (\<lambda>x. if i < k then x i else if i = k then 0 else x (i -1))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   194
      by (auto intro: continuous_map_product_projection)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   195
    then show "continuous_map (subtopology ?PT (standard_simplex (p - Suc 0))) euclideanreal
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   196
                              (\<lambda>x. simplical_face k x i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   197
      by (simp add: simplical_face_def continuous_map_from_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   198
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   199
  have 2: "continuous_map (subtopology ?PT (standard_simplex p)) X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   200
    using assms(1) singular_simplex_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   201
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   202
    by (simp add: singular_simplex_def singular_face_def continuous_map_compose [OF 1 2])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   203
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   204
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   205
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   206
subsection\<open>Singular chains\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   207
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   208
definition singular_chain :: "[nat, 'a topology, 'a chain] \<Rightarrow> bool"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   209
  where "singular_chain p X c \<equiv> Poly_Mapping.keys c \<subseteq> singular_simplex_set p X"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   210
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   211
abbreviation singular_chain_set :: "[nat, 'a topology] \<Rightarrow> ('a chain) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   212
  where "singular_chain_set p X \<equiv> Collect (singular_chain p X)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   213
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   214
lemma singular_chain_empty:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   215
   "topspace X = {} \<Longrightarrow> singular_chain p X c \<longleftrightarrow> c = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   216
  by (auto simp: singular_chain_def singular_simplex_empty subset_eq poly_mapping_eqI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   217
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   218
lemma singular_chain_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   219
   "\<lbrakk>singular_chain p (subtopology X T) c;  T \<subseteq> S\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   220
        \<Longrightarrow> singular_chain p (subtopology X S) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   221
  unfolding singular_chain_def using singular_simplex_mono by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   222
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   223
lemma singular_chain_subtopology:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   224
   "singular_chain p (subtopology X S) c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   225
        singular_chain p X c \<and> (\<forall>f \<in> Poly_Mapping.keys c. f ` (standard_simplex p) \<subseteq> S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   226
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   227
  by (fastforce simp add: singular_simplex_subtopology subset_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   228
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   229
lemma singular_chain_0 [iff]: "singular_chain p X 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   230
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   231
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   232
lemma singular_chain_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   233
   "singular_chain p X (frag_of c) \<longleftrightarrow> singular_simplex p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   234
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   235
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   236
lemma singular_chain_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   237
   "singular_chain p X c \<Longrightarrow> singular_chain p X (frag_cmul a c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   238
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   239
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   240
lemma singular_chain_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   241
   "singular_chain p X (-c) \<longleftrightarrow> singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   242
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   243
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   244
lemma singular_chain_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   245
   "\<lbrakk>singular_chain p X a; singular_chain p X b\<rbrakk> \<Longrightarrow> singular_chain p X (a+b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   246
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   247
  using keys_add [of a b] by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   248
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   249
lemma singular_chain_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   250
   "\<lbrakk>singular_chain p X a; singular_chain p X b\<rbrakk> \<Longrightarrow> singular_chain p X (a-b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   251
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   252
  using keys_diff [of a b] by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   253
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   254
lemma singular_chain_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   255
   "(\<And>i. i \<in> I \<Longrightarrow> singular_chain p X (f i)) \<Longrightarrow> singular_chain p X (\<Sum>i\<in>I. f i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   256
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   257
  using keys_sum [of f I] by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   258
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   259
lemma singular_chain_extend:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   260
   "(\<And>c. c \<in> Poly_Mapping.keys x \<Longrightarrow> singular_chain p X (f c))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   261
        \<Longrightarrow> singular_chain p X (frag_extend f x)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   262
  by (simp add: frag_extend_def singular_chain_cmul singular_chain_sum)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   263
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   264
subsection\<open>Boundary homomorphism for singular chains\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   265
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   266
definition chain_boundary :: "nat \<Rightarrow> ('a chain) \<Rightarrow> 'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   267
  where "chain_boundary p c \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   268
          (if p = 0 then 0 else
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   269
           frag_extend (\<lambda>f. (\<Sum>k\<le>p. frag_cmul ((-1) ^ k) (frag_of(singular_face p k f)))) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   270
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   271
lemma singular_chain_boundary:
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   272
  assumes "singular_chain p X c"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   273
  shows "singular_chain (p - Suc 0) X (chain_boundary p c)"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   274
  unfolding chain_boundary_def
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   275
proof (clarsimp intro!: singular_chain_extend singular_chain_sum singular_chain_cmul)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   276
  show "\<And>d k. \<lbrakk>0 < p; d \<in> Poly_Mapping.keys c; k \<le> p\<rbrakk>
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   277
       \<Longrightarrow> singular_chain (p - Suc 0) X (frag_of (singular_face p k d))"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   278
    using assms by (auto simp: singular_chain_def intro: singular_simplex_singular_face)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   279
qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   280
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   281
lemma singular_chain_boundary_alt:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   282
   "singular_chain (Suc p) X c \<Longrightarrow> singular_chain p X (chain_boundary (Suc p) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   283
  using singular_chain_boundary by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   284
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   285
lemma chain_boundary_0 [simp]: "chain_boundary p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   286
  by (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   287
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   288
lemma chain_boundary_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   289
   "chain_boundary p (frag_cmul k c) = frag_cmul k (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   290
  by (auto simp: chain_boundary_def frag_extend_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   291
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   292
lemma chain_boundary_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   293
   "chain_boundary p (- c) = - (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   294
  by (metis chain_boundary_cmul frag_cmul_minus_one)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   295
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   296
lemma chain_boundary_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   297
   "chain_boundary p (a+b) = chain_boundary p a + chain_boundary p b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   298
  by (simp add: chain_boundary_def frag_extend_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   299
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   300
lemma chain_boundary_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   301
   "chain_boundary p (a-b) = chain_boundary p a - chain_boundary p b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   302
  using chain_boundary_add [of p a "-b"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   303
  by (simp add: chain_boundary_minus)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   304
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   305
lemma chain_boundary_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   306
   "chain_boundary p (sum g I) = sum (chain_boundary p \<circ> g) I"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   307
  by (induction I rule: infinite_finite_induct) (simp_all add: chain_boundary_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   308
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   309
lemma chain_boundary_sum':
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   310
   "finite I \<Longrightarrow> chain_boundary p (sum' g I) = sum' (chain_boundary p \<circ> g) I"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   311
  by (induction I rule: finite_induct) (simp_all add: chain_boundary_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   312
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   313
lemma chain_boundary_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   314
   "chain_boundary p (frag_of f) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   315
        (if p = 0 then 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   316
         else (\<Sum>k\<le>p. frag_cmul ((-1) ^ k) (frag_of(singular_face p k f))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   317
  by (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   318
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   319
subsection\<open>Factoring out chains in a subtopology for relative homology\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   320
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   321
definition mod_subset
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   322
  where "mod_subset p X \<equiv> {(a,b). singular_chain p X (a - b)}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   323
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   324
lemma mod_subset_empty [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   325
   "(a,b) \<in> (mod_subset p (subtopology X {})) \<longleftrightarrow> a = b"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   326
  by (simp add: mod_subset_def singular_chain_empty)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   327
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   328
lemma mod_subset_refl [simp]: "(c,c) \<in> mod_subset p X"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   329
  by (auto simp: mod_subset_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   330
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   331
lemma mod_subset_cmul:
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   332
  assumes "(a,b) \<in> mod_subset p X"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   333
  shows "(frag_cmul k a, frag_cmul k b) \<in> mod_subset p X"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   334
  using assms
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   335
  by (simp add: mod_subset_def) (metis (no_types, lifting) add_diff_cancel diff_add_cancel frag_cmul_distrib2 singular_chain_cmul)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   336
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   337
lemma mod_subset_add:
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   338
   "\<lbrakk>(c1,c2) \<in> mod_subset p X; (d1,d2) \<in> mod_subset p X\<rbrakk> \<Longrightarrow> (c1+d1, c2+d2) \<in> mod_subset p X"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   339
  by (simp add: mod_subset_def add_diff_add singular_chain_add)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   340
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   341
subsection\<open>Relative cycles $Z_pX (S)$ where $X$ is a topology and $S$ a subset \<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   342
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   343
definition singular_relcycle :: "nat \<Rightarrow> 'a topology \<Rightarrow> 'a set \<Rightarrow> ('a chain) \<Rightarrow> bool"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   344
  where "singular_relcycle p X S \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   345
        \<lambda>c. singular_chain p X c \<and> (chain_boundary p c, 0) \<in> mod_subset (p-1) (subtopology X S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   346
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   347
abbreviation singular_relcycle_set
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   348
  where "singular_relcycle_set p X S \<equiv> Collect (singular_relcycle p X S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   349
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   350
lemma singular_relcycle_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   351
   "singular_relcycle p X (topspace X \<inter> S) = singular_relcycle p X S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   352
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   353
  have eq: "subtopology X (topspace X \<inter> S) = subtopology X S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   354
    by (metis subtopology_subtopology subtopology_topspace)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   355
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   356
    by (force simp: singular_relcycle_def eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   357
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   358
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   359
lemma singular_relcycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   360
   "singular_relcycle p X S c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   361
    singular_chain p X c \<and> singular_chain (p-1) (subtopology X S) (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   362
  by (simp add: singular_relcycle_def mod_subset_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   363
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   364
lemma singular_relcycle_0 [simp]: "singular_relcycle p X S 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   365
  by (auto simp: singular_relcycle_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   366
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   367
lemma singular_relcycle_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   368
   "singular_relcycle p X S c \<Longrightarrow> singular_relcycle p X S (frag_cmul k c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   369
  by (auto simp: singular_relcycle_def chain_boundary_cmul dest: singular_chain_cmul mod_subset_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   370
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   371
lemma singular_relcycle_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   372
   "singular_relcycle p X S (-c) \<longleftrightarrow> singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   373
  by (simp add: chain_boundary_minus singular_chain_minus singular_relcycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   374
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   375
lemma singular_relcycle_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   376
   "\<lbrakk>singular_relcycle p X S a; singular_relcycle p X S b\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   377
        \<Longrightarrow> singular_relcycle p X S (a+b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   378
  by (simp add: singular_relcycle_def chain_boundary_add mod_subset_def singular_chain_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   379
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   380
lemma singular_relcycle_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   381
   "\<lbrakk>\<And>i. i \<in> I \<Longrightarrow> singular_relcycle p X S (f i)\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   382
        \<Longrightarrow> singular_relcycle p X S (sum f I)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   383
  by (induction I rule: infinite_finite_induct) (auto simp: singular_relcycle_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   384
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   385
lemma singular_relcycle_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   386
   "\<lbrakk>singular_relcycle p X S a; singular_relcycle p X S b\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   387
        \<Longrightarrow> singular_relcycle p X S (a-b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   388
  by (metis singular_relcycle_add singular_relcycle_minus uminus_add_conv_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   389
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   390
lemma singular_cycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   391
   "singular_relcycle p X {} c \<longleftrightarrow> singular_chain p X c \<and> chain_boundary p c = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   392
  by (simp add: singular_relcycle_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   393
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   394
lemma singular_cycle_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   395
   "\<lbrakk>singular_relcycle p (subtopology X T) {} c; T \<subseteq> S\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   396
        \<Longrightarrow> singular_relcycle p (subtopology X S) {} c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   397
  by (auto simp: singular_cycle elim: singular_chain_mono)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   398
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   399
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   400
subsection\<open>Relative boundaries $B_p X S$, where $X$ is a topology and $S$ a subset.\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   401
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   402
definition singular_relboundary :: "nat \<Rightarrow> 'a topology \<Rightarrow> 'a set \<Rightarrow> ('a chain) \<Rightarrow> bool"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   403
  where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   404
  "singular_relboundary p X S \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   405
    \<lambda>c. \<exists>d. singular_chain (Suc p) X d \<and> (chain_boundary (Suc p) d, c) \<in> (mod_subset p (subtopology X S))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   406
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   407
abbreviation singular_relboundary_set :: "nat \<Rightarrow> 'a topology \<Rightarrow> 'a set \<Rightarrow> ('a chain) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   408
  where "singular_relboundary_set p X S \<equiv> Collect (singular_relboundary p X S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   409
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   410
lemma singular_relboundary_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   411
   "singular_relboundary p X (topspace X \<inter> S) = singular_relboundary p X S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   412
  unfolding singular_relboundary_def
73932
fd21b4a93043 added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents: 73655
diff changeset
   413
  by (metis (no_types, opaque_lifting) subtopology_subtopology subtopology_topspace)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   414
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   415
lemma singular_relboundary_alt:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   416
   "singular_relboundary p X S c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   417
    (\<exists>d e. singular_chain (Suc p) X d \<and> singular_chain p (subtopology X S) e \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   418
           chain_boundary (Suc p) d = c + e)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   419
  unfolding singular_relboundary_def mod_subset_def by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   420
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   421
lemma singular_relboundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   422
   "singular_relboundary p X S c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   423
    (\<exists>d e. singular_chain (Suc p) X d \<and> singular_chain p (subtopology X S) e \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   424
              (chain_boundary (Suc p) d) + e = c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   425
  using singular_chain_minus
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   426
  by (fastforce simp add: singular_relboundary_alt)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   427
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   428
lemma singular_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   429
   "singular_relboundary p X {} c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   430
    (\<exists>d. singular_chain (Suc p) X d \<and> chain_boundary (Suc p) d = c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   431
  by (simp add: singular_relboundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   432
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   433
lemma singular_boundary_imp_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   434
   "singular_relboundary p X {} c \<Longrightarrow> singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   435
  by (auto simp: singular_relboundary singular_chain_boundary_alt singular_chain_empty topspace_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   436
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   437
lemma singular_boundary_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   438
   "\<lbrakk>T \<subseteq> S; singular_relboundary p (subtopology X T) {} c\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   439
        \<Longrightarrow> singular_relboundary p (subtopology X S) {} c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   440
  by (metis mod_subset_empty singular_chain_mono singular_relboundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   441
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   442
lemma singular_relboundary_imp_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   443
   "singular_relboundary p X S c \<Longrightarrow> singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   444
  unfolding singular_relboundary singular_chain_subtopology
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   445
  by (blast intro: singular_chain_add singular_chain_boundary_alt)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   446
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   447
lemma singular_chain_imp_relboundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   448
   "singular_chain p (subtopology X S) c \<Longrightarrow> singular_relboundary p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   449
  unfolding singular_relboundary_def
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   450
  using mod_subset_def singular_chain_minus by fastforce
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   451
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   452
lemma singular_relboundary_0 [simp]: "singular_relboundary p X S 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   453
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   454
  by (rule_tac x=0 in exI) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   455
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   456
lemma singular_relboundary_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   457
   "singular_relboundary p X S c \<Longrightarrow> singular_relboundary p X S (frag_cmul a c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   458
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   459
  by (metis chain_boundary_cmul mod_subset_cmul singular_chain_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   460
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   461
lemma singular_relboundary_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   462
   "singular_relboundary p X S (-c) \<longleftrightarrow> singular_relboundary p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   463
  using singular_relboundary_cmul
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   464
  by (metis add.inverse_inverse frag_cmul_minus_one)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   465
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   466
lemma singular_relboundary_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   467
   "\<lbrakk>singular_relboundary p X S a; singular_relboundary p X S b\<rbrakk> \<Longrightarrow> singular_relboundary p X S (a+b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   468
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   469
  by (metis chain_boundary_add mod_subset_add singular_chain_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   470
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   471
lemma singular_relboundary_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   472
   "\<lbrakk>singular_relboundary p X S a; singular_relboundary p X S b\<rbrakk> \<Longrightarrow> singular_relboundary p X S (a-b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   473
  by (metis uminus_add_conv_diff singular_relboundary_minus singular_relboundary_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   474
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   475
subsection\<open>The (relative) homology relation\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   476
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   477
definition homologous_rel :: "[nat,'a topology,'a set,'a chain,'a chain] \<Rightarrow> bool"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   478
  where "homologous_rel p X S \<equiv> \<lambda>a b. singular_relboundary p X S (a-b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   479
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   480
abbreviation homologous_rel_set
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   481
  where "homologous_rel_set p X S a \<equiv> Collect (homologous_rel p X S a)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   482
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   483
lemma homologous_rel_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   484
   "homologous_rel p X (topspace X \<inter> S) = homologous_rel p X S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   485
  unfolding homologous_rel_def by (metis singular_relboundary_restrict)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   486
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   487
lemma homologous_rel_refl [simp]: "homologous_rel p X S c c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   488
  unfolding homologous_rel_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   489
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   490
lemma homologous_rel_sym:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   491
   "homologous_rel p X S a b = homologous_rel p X S b a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   492
  unfolding homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   493
  using singular_relboundary_minus by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   494
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   495
lemma homologous_rel_trans:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   496
  assumes "homologous_rel p X S b c" "homologous_rel p X S a b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   497
  shows "homologous_rel p X S a c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   498
  using homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   499
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   500
  have "singular_relboundary p X S (b - c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   501
    using assms unfolding homologous_rel_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   502
  moreover have "singular_relboundary p X S (b - a)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   503
    using assms by (meson homologous_rel_def homologous_rel_sym)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   504
  ultimately have "singular_relboundary p X S (c - a)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   505
    using singular_relboundary_diff by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   506
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   507
    by (meson homologous_rel_def homologous_rel_sym)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   508
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   509
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   510
lemma homologous_rel_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   511
   "homologous_rel p X S a = homologous_rel p X S b \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   512
    homologous_rel p X S a b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   513
  using homologous_rel_sym homologous_rel_trans by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   514
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   515
lemma homologous_rel_set_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   516
   "homologous_rel_set p X S a = homologous_rel_set p X S b \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   517
    homologous_rel p X S a b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   518
  by (metis homologous_rel_eq mem_Collect_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   519
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   520
lemma homologous_rel_singular_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   521
  "homologous_rel p X S a b \<Longrightarrow> (singular_chain p X a \<longleftrightarrow> singular_chain p X b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   522
  unfolding homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   523
  using singular_chain_diff singular_chain_add
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   524
  by (fastforce dest: singular_relboundary_imp_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   525
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   526
lemma homologous_rel_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   527
   "\<lbrakk>homologous_rel p X S a a'; homologous_rel p X S b b'\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   528
        \<Longrightarrow> homologous_rel p X S (a+b) (a'+b')"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   529
  unfolding homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   530
  by (simp add: add_diff_add singular_relboundary_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   531
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   532
lemma homologous_rel_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   533
  assumes "homologous_rel p X S a a'" "homologous_rel p X S b b'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   534
  shows "homologous_rel p X S (a - b) (a' - b')"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   535
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   536
  have "singular_relboundary p X S ((a - a') - (b - b'))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   537
    using assms singular_relboundary_diff unfolding homologous_rel_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   538
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   539
    by (simp add: homologous_rel_def algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   540
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   541
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   542
lemma homologous_rel_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   543
  assumes f: "finite {i \<in> I. f i \<noteq> 0}" and g: "finite {i \<in> I. g i \<noteq> 0}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   544
    and h: "\<And>i. i \<in> I \<Longrightarrow> homologous_rel p X S (f i) (g i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   545
  shows "homologous_rel p X S (sum f I) (sum g I)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   546
proof (cases "finite I")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   547
  case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   548
  let ?L = "{i \<in> I. f i \<noteq> 0} \<union> {i \<in> I. g i \<noteq> 0}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   549
  have L: "finite ?L" "?L \<subseteq> I"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   550
    using f g by blast+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   551
  have "sum f I = sum f ?L"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   552
    by (rule comm_monoid_add_class.sum.mono_neutral_right [OF True]) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   553
  moreover have "sum g I = sum g ?L"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   554
    by (rule comm_monoid_add_class.sum.mono_neutral_right [OF True]) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   555
  moreover have *: "homologous_rel p X S (f i) (g i)" if "i \<in> ?L" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   556
    using h that by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   557
  have "homologous_rel p X S (sum f ?L) (sum g ?L)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   558
    using L
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   559
  proof induction
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   560
    case (insert j J)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   561
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   562
      by (simp add: h homologous_rel_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   563
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   564
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   565
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   566
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   567
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   568
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   569
lemma chain_homotopic_imp_homologous_rel:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   570
  assumes
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   571
   "\<And>c. singular_chain p X c \<Longrightarrow> singular_chain (Suc p) X' (h c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   572
   "\<And>c. singular_chain (p -1) (subtopology X S) c \<Longrightarrow> singular_chain p (subtopology X' T) (h' c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   573
   "\<And>c. singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   574
             \<Longrightarrow> (chain_boundary (Suc p) (h c)) + (h'(chain_boundary p c)) = f c - g c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   575
    "singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   576
  shows "homologous_rel p X' T (f c) (g c)"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   577
proof -
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   578
  have "singular_chain p (subtopology X' T) (chain_boundary (Suc p) (h c) - (f c - g c))"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   579
    using assms
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   580
    by (metis (no_types, lifting) add_diff_cancel_left' minus_diff_eq singular_chain_minus singular_relcycle)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   581
  then show ?thesis
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   582
  using assms
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   583
    by (metis homologous_rel_def singular_relboundary singular_relcycle)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   584
qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   585
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   586
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   587
subsection\<open>Show that all boundaries are cycles, the key "chain complex" property.\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   588
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   589
lemma chain_boundary_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   590
  assumes "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   591
  shows "chain_boundary (p - Suc 0) (chain_boundary p c) = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   592
proof (cases "p -1 = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   593
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   594
  then have "2 \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   595
    by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   596
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   597
    using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   598
    unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   599
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   600
    case (one g)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   601
    then have ss: "singular_simplex p X g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   602
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   603
    have eql: "{..p} \<times> {..p - Suc 0} \<inter> {(x, y). y < x} = (\<lambda>(j,i). (Suc i, j)) ` {(i,j). i \<le> j \<and> j \<le> p -1}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   604
      using False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   605
      by (auto simp: image_def) (metis One_nat_def diff_Suc_1 diff_le_mono le_refl lessE less_imp_le_nat)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   606
    have eqr: "{..p} \<times> {..p - Suc 0} - {(x, y). y < x} = {(i,j). i \<le> j \<and> j \<le> p -1}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   607
      by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   608
    have eqf: "singular_face (p - Suc 0) i (singular_face p (Suc j) g) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   609
               singular_face (p - Suc 0) j (singular_face p i g)" if "i \<le> j" "j \<le> p - Suc 0" for i j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   610
    proof (rule ext)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   611
      fix t
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   612
      show "singular_face (p - Suc 0) i (singular_face p (Suc j) g) t =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   613
            singular_face (p - Suc 0) j (singular_face p i g) t"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   614
      proof (cases "t \<in> standard_simplex (p -1 -1)")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
        case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   616
        have fi: "simplical_face i t \<in> standard_simplex (p - Suc 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   617
          using False True simplical_face_in_standard_simplex that by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   618
        have fj: "simplical_face j t \<in> standard_simplex (p - Suc 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   619
          by (metis False One_nat_def True simplical_face_in_standard_simplex less_one not_less that(2))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   620
        have eq: "simplical_face (Suc j) (simplical_face i t) = simplical_face i (simplical_face j t)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   621
          using True that ss
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   622
          unfolding standard_simplex_def simplical_face_def by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   623
        show ?thesis by (simp add: singular_face_def fi fj eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   624
      qed (simp add: singular_face_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   625
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   626
    show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   627
    proof (cases "p = 1")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   628
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   629
      have eq0: "frag_cmul (-1) a = b \<Longrightarrow> a + b = 0" for a b
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   630
        by (simp add: neg_eq_iff_add_eq_0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   631
      have *: "(\<Sum>x\<le>p. \<Sum>i\<le>p - Suc 0.
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   632
                 frag_cmul ((-1) ^ (x + i)) (frag_of (singular_face (p - Suc 0) i (singular_face p x g))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   633
              = 0"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
   634
        apply (simp add: sum.cartesian_product sum.Int_Diff [of "_ \<times> _" _ "{(x,y). y < x}"])
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   635
        apply (rule eq0)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   636
        unfolding frag_cmul_sum prod.case_distrib [of "frag_cmul (-1)"] frag_cmul_cmul eql eqr 
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   637
        apply (force simp: inj_on_def sum.reindex add.commute eqf intro: sum.cong)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   638
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   639
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   640
        using False by (simp add: chain_boundary_of chain_boundary_sum chain_boundary_cmul frag_cmul_sum * flip: power_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   641
    qed (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   643
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
      by (simp add: chain_boundary_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   646
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   647
qed (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   648
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   649
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   650
lemma chain_boundary_boundary_alt:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   651
   "singular_chain (Suc p) X c \<Longrightarrow> chain_boundary p (chain_boundary (Suc p) c) = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   652
  using chain_boundary_boundary by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   653
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   654
lemma singular_relboundary_imp_relcycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   655
  assumes "singular_relboundary p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   656
  shows "singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   657
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   658
  obtain d e where d: "singular_chain (Suc p) X d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   659
               and e: "singular_chain p (subtopology X S) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   660
               and c: "c = chain_boundary (Suc p) d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   661
    using assms by (auto simp: singular_relboundary singular_relcycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
  have 1: "singular_chain (p - Suc 0) (subtopology X S) (chain_boundary p (chain_boundary (Suc p) d))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   663
    using d chain_boundary_boundary_alt by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   664
  have 2: "singular_chain (p - Suc 0) (subtopology X S) (chain_boundary p e)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   665
    using \<open>singular_chain p (subtopology X S) e\<close> singular_chain_boundary by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   666
  have "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   667
    using assms singular_relboundary_imp_chain by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   668
  moreover have "singular_chain (p - Suc 0) (subtopology X S) (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   669
    by (simp add: c chain_boundary_add singular_chain_add 1 2)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   670
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   671
    by (simp add: singular_relcycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   672
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   673
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   674
lemma homologous_rel_singular_relcycle_1:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   675
  assumes "homologous_rel p X S c1 c2" "singular_relcycle p X S c1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   676
  shows "singular_relcycle p X S c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   677
  using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   678
  by (metis diff_add_cancel homologous_rel_def homologous_rel_sym singular_relboundary_imp_relcycle singular_relcycle_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   679
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   680
lemma homologous_rel_singular_relcycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   681
  assumes "homologous_rel p X S c1 c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   682
  shows "singular_relcycle p X S c1 = singular_relcycle p X S c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   683
  using assms homologous_rel_singular_relcycle_1
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   684
  using homologous_rel_sym by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   685
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   686
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   687
subsection\<open>Operations induced by a continuous map g between topological spaces\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   688
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   689
definition simplex_map :: "nat \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> ((nat \<Rightarrow> real) \<Rightarrow> 'b) \<Rightarrow> (nat \<Rightarrow> real) \<Rightarrow> 'a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   690
  where "simplex_map p g c \<equiv> restrict (g \<circ> c) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   691
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   692
lemma singular_simplex_simplex_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   693
   "\<lbrakk>singular_simplex p X f; continuous_map X X' g\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   694
        \<Longrightarrow> singular_simplex p X' (simplex_map p g f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   695
  unfolding singular_simplex_def simplex_map_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   696
  by (auto simp: continuous_map_compose)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   697
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   698
lemma simplex_map_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   699
   "\<lbrakk>singular_simplex p X c;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   700
     \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   701
    \<Longrightarrow> simplex_map p f c = simplex_map p g c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   702
  by (auto simp: singular_simplex_def simplex_map_def continuous_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   703
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   704
lemma simplex_map_id_gen:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   705
   "\<lbrakk>singular_simplex p X c;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   706
     \<And>x. x \<in> topspace X \<Longrightarrow> f x = x\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   707
    \<Longrightarrow> simplex_map p f c = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   708
  unfolding singular_simplex_def simplex_map_def continuous_map_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   709
  using extensional_arb by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   710
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   711
lemma simplex_map_id [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   712
   "simplex_map p id = (\<lambda>c. restrict c (standard_simplex p))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   713
  by (auto simp: simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   714
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   715
lemma simplex_map_compose:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   716
   "simplex_map p (h \<circ> g) = simplex_map p h \<circ> simplex_map p g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   717
  unfolding simplex_map_def by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   718
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   719
lemma singular_face_simplex_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   720
   "\<lbrakk>1 \<le> p; k \<le> p\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   721
        \<Longrightarrow> singular_face p k (simplex_map p f c) = simplex_map (p - Suc 0) f (c \<circ> simplical_face k)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   722
  unfolding simplex_map_def singular_face_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   723
  by (force simp: simplical_face_in_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   724
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   725
lemma singular_face_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   726
  assumes "p > 0" "i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   727
  shows "singular_face p i (restrict f (standard_simplex p)) = singular_face p i f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   728
  by (metis assms One_nat_def Suc_leI simplex_map_id singular_face_def singular_face_simplex_map)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   729
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   730
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   731
definition chain_map :: "nat \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> (((nat \<Rightarrow> real) \<Rightarrow> 'b) \<Rightarrow>\<^sub>0 int) \<Rightarrow> 'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   732
  where "chain_map p g c \<equiv> frag_extend (frag_of \<circ> simplex_map p g) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   733
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   734
lemma singular_chain_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   735
   "\<lbrakk>singular_chain p X c; continuous_map X X' g\<rbrakk> \<Longrightarrow> singular_chain p X' (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   736
  unfolding chain_map_def
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   737
  by (force simp add: singular_chain_def subset_iff 
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   738
      intro!: singular_chain_extend singular_simplex_simplex_map)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   739
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   740
lemma chain_map_0 [simp]: "chain_map p g 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   741
  by (auto simp: chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   742
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   743
lemma chain_map_of [simp]: "chain_map p g (frag_of f) = frag_of (simplex_map p g f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   744
  by (simp add: chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   745
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   746
lemma chain_map_cmul [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   747
   "chain_map p g (frag_cmul a c) = frag_cmul a (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   748
  by (simp add: frag_extend_cmul chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   749
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   750
lemma chain_map_minus: "chain_map p g (-c) = - (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   751
  by (simp add: frag_extend_minus chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   752
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   753
lemma chain_map_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   754
   "chain_map p g (a+b) = chain_map p g a + chain_map p g b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   755
  by (simp add: frag_extend_add chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   756
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   757
lemma chain_map_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   758
   "chain_map p g (a-b) = chain_map p g a - chain_map p g b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   759
  by (simp add: frag_extend_diff chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   760
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   761
lemma chain_map_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   762
   "finite I \<Longrightarrow> chain_map p g (sum f I) = sum (chain_map p g \<circ> f) I"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   763
  by (simp add: frag_extend_sum chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   764
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   765
lemma chain_map_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   766
   "\<lbrakk>singular_chain p X c; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   767
    \<Longrightarrow> chain_map p f c = chain_map p g c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   768
  unfolding singular_chain_def
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   769
proof (induction rule: frag_induction)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   770
  case (one x)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   771
  then show ?case
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   772
    by (metis (no_types, lifting) chain_map_of mem_Collect_eq simplex_map_eq)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   773
qed (auto simp: chain_map_diff)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   774
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   775
lemma chain_map_id_gen:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   776
   "\<lbrakk>singular_chain p X c; \<And>x. x \<in> topspace X \<Longrightarrow> f x = x\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   777
    \<Longrightarrow>  chain_map p f c = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   778
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   779
  by (erule frag_induction) (auto simp: chain_map_diff simplex_map_id_gen)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   780
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   781
lemma chain_map_ident:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   782
   "singular_chain p X c \<Longrightarrow> chain_map p id c = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   783
  by (simp add: chain_map_id_gen)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   784
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   785
lemma chain_map_id:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   786
   "chain_map p id = frag_extend (frag_of \<circ> (\<lambda>f. restrict f (standard_simplex p)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   787
  by (auto simp: chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   788
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   789
lemma chain_map_compose:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   790
   "chain_map p (h \<circ> g) = chain_map p h \<circ> chain_map p g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   791
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   792
  show "chain_map p (h \<circ> g) c = (chain_map p h \<circ> chain_map p g) c" for c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   793
    using subset_UNIV
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   794
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   795
    case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   796
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   797
      by simp (metis (mono_tags, lifting) comp_eq_dest_lhs restrict_apply simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   798
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   799
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   800
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   801
      by (simp add: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   802
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   803
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   804
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   805
lemma singular_simplex_chain_map_id:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   806
  assumes "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   807
  shows "chain_map p f (frag_of (restrict id (standard_simplex p))) = frag_of f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   808
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   809
  have "(restrict (f \<circ> restrict id (standard_simplex p)) (standard_simplex p)) = f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   810
    by (rule ext) (metis assms comp_apply extensional_arb id_apply restrict_apply singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   811
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   812
    by (simp add: simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   813
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   814
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   815
lemma chain_boundary_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   816
  assumes "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   817
  shows "chain_boundary p (chain_map p g c) = chain_map (p - Suc 0) g (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   818
  using assms unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   819
proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   820
  case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   821
  then have "singular_face p i (simplex_map p g x) = simplex_map (p - Suc 0) g (singular_face p i x)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   822
    if "0 \<le> i" "i \<le> p" "p \<noteq> 0" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   823
    using that
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   824
    by (fastforce simp add: singular_face_def simplex_map_def simplical_face_in_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   825
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   826
    by (auto simp: chain_boundary_of chain_map_sum)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   827
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   828
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   829
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   830
    by (simp add: chain_boundary_diff chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   831
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   832
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   833
lemma singular_relcycle_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   834
  assumes "singular_relcycle p X S c" "continuous_map X X' g" "g ` S \<subseteq> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   835
  shows "singular_relcycle p X' T (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   836
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   837
  have "continuous_map (subtopology X S) (subtopology X' T) g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   838
    using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   839
    using continuous_map_from_subtopology continuous_map_in_subtopology topspace_subtopology by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   840
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   841
    using chain_boundary_chain_map [of p X c g]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   842
    by (metis One_nat_def assms(1) assms(2) singular_chain_chain_map singular_relcycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   843
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   844
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   845
lemma singular_relboundary_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   846
  assumes "singular_relboundary p X S c" "continuous_map X X' g" "g ` S \<subseteq> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   847
  shows "singular_relboundary p X' T (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   848
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   849
  obtain d e where d: "singular_chain (Suc p) X d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   850
    and e: "singular_chain p (subtopology X S) e" and c: "c = chain_boundary (Suc p) d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   851
    using assms by (auto simp: singular_relboundary)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   852
  have "singular_chain (Suc p) X' (chain_map (Suc p) g d)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   853
    using assms(2) d singular_chain_chain_map by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   854
  moreover have "singular_chain p (subtopology X' T) (chain_map p g e)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   855
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   856
    have "\<forall>t. g ` topspace (subtopology t S) \<subseteq> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   857
      by (metis assms(3) closure_of_subset_subtopology closure_of_topspace dual_order.trans image_mono)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   858
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   859
      by (meson assms(2) continuous_map_from_subtopology continuous_map_in_subtopology e singular_chain_chain_map)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   860
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   861
  moreover have "chain_boundary (Suc p) (chain_map (Suc p) g d) + chain_map p g e =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   862
                 chain_map p g (chain_boundary (Suc p) d + e)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   863
    by (metis One_nat_def chain_boundary_chain_map chain_map_add d diff_Suc_1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   864
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   865
    unfolding singular_relboundary
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   866
    using c by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   867
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   868
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   869
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   870
subsection\<open>Homology of one-point spaces degenerates except for $p = 0$.\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   871
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   872
lemma singular_simplex_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   873
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   874
  shows "singular_simplex p X f \<longleftrightarrow> f = restrict (\<lambda>x. a) (standard_simplex p)" (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   875
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   876
  assume L: ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   877
  then show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   878
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   879
    have "continuous_map (subtopology (product_topology (\<lambda>n. euclideanreal) UNIV) (standard_simplex p)) X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   880
      using \<open>singular_simplex p X f\<close> singular_simplex_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   881
    then have "\<And>c. c \<notin> standard_simplex p \<or> f c = a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   882
      by (simp add: assms continuous_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   883
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   884
      by (metis (no_types) L extensional_restrict restrict_ext singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   885
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   886
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   887
  assume ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   888
  with assms show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   889
    by (auto simp: singular_simplex_def topspace_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   890
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   891
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   892
lemma singular_chain_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   893
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   894
  shows "singular_chain p X c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   895
         (\<exists>b. c = frag_cmul b (frag_of(restrict (\<lambda>x. a) (standard_simplex p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   896
    (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   897
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   898
  let ?f = "restrict (\<lambda>x. a) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   899
  assume L: ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   900
  with assms have "Poly_Mapping.keys c \<subseteq> {?f}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   901
    by (auto simp: singular_chain_def singular_simplex_singleton)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   902
  then consider "Poly_Mapping.keys c = {}" | "Poly_Mapping.keys c = {?f}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   903
    by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   904
  then show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   905
  proof cases
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   906
    case 1
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   907
    with L show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   908
      by (metis frag_cmul_zero keys_eq_empty)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   909
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   910
    case 2
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   911
    then have "\<exists>b. frag_extend frag_of c = frag_cmul b (frag_of (\<lambda>x\<in>standard_simplex p. a))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   912
      by (force simp: frag_extend_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   913
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   914
      by (metis frag_expansion)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   915
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   916
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   917
  assume ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   918
  with assms show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   919
    by (auto simp: singular_chain_def singular_simplex_singleton)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   920
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   921
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   922
lemma chain_boundary_of_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   923
  assumes tX: "topspace X = {a}" and sc: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   924
  shows "chain_boundary p c =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   925
         (if p = 0 \<or> odd p then 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   926
          else frag_extend (\<lambda>f. frag_of(restrict (\<lambda>x. a) (standard_simplex (p -1)))) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   927
    (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   928
proof (cases "p = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   929
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   930
  have "?lhs = frag_extend (\<lambda>f. if odd p then 0 else frag_of(restrict (\<lambda>x. a) (standard_simplex (p -1)))) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   931
  proof (simp only: chain_boundary_def False if_False, rule frag_extend_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   932
    fix f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   933
    assume "f \<in> Poly_Mapping.keys c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   934
    with assms have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   935
      by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   936
    then have *: "\<And>k. k \<le> p \<Longrightarrow> singular_face p k f = (\<lambda>x\<in>standard_simplex (p -1). a)"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   937
      using False singular_simplex_singular_face 
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   938
      by (fastforce simp flip: singular_simplex_singleton [OF tX])
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   939
    define c where "c \<equiv> frag_of (\<lambda>x\<in>standard_simplex (p -1). a)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   940
    have "(\<Sum>k\<le>p. frag_cmul ((-1) ^ k) (frag_of (singular_face p k f)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   941
        = (\<Sum>k\<le>p. frag_cmul ((-1) ^ k) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   942
      by (auto simp: c_def * intro: sum.cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   943
    also have "\<dots> = (if odd p then 0 else c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   944
      by (induction p) (auto simp: c_def restrict_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   945
    finally show "(\<Sum>k\<le>p. frag_cmul ((-1) ^ k) (frag_of (singular_face p k f)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   946
                = (if odd p then 0 else frag_of (\<lambda>x\<in>standard_simplex (p -1). a))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   947
      unfolding c_def .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   948
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   949
  also have "\<dots> = ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   950
    by (auto simp: False frag_extend_eq_0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   951
  finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   952
qed (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   953
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   954
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   955
lemma singular_cycle_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   956
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   957
  shows "singular_relcycle p X {} c \<longleftrightarrow> singular_chain p X c \<and> (p = 0 \<or> odd p \<or> c = 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   958
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   959
  have "c = 0" if "singular_chain p X c" and "chain_boundary p c = 0" and "even p" and "p \<noteq> 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   960
    using that assms singular_chain_singleton [of X a p c] chain_boundary_of_singleton [OF assms]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   961
    by (auto simp: frag_extend_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   962
  moreover
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   963
  have "chain_boundary p c = 0" if sc: "singular_chain p X c" and "odd p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   964
    by (simp add: chain_boundary_of_singleton [OF assms sc] that)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   965
  moreover have "chain_boundary 0 c = 0" if "singular_chain 0 X c" and "p = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   966
    by (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   967
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   968
  using assms by (auto simp: singular_cycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   969
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   970
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   971
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   972
lemma singular_boundary_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   973
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   974
  shows "singular_relboundary p X {} c \<longleftrightarrow> singular_chain p X c \<and> (odd p \<or> c = 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   975
proof (cases "singular_chain p X c")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   976
  case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   977
  have "\<exists>d. singular_chain (Suc p) X d \<and> chain_boundary (Suc p) d = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   978
    if "singular_chain p X c" and "odd p"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   979
  proof -
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   980
    obtain b where b: "c = frag_cmul b (frag_of(restrict (\<lambda>x. a) (standard_simplex p)))"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   981
      by (metis True assms singular_chain_singleton)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   982
    let ?d = "frag_cmul b (frag_of (\<lambda>x\<in>standard_simplex (Suc p). a))"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   983
    have scd: "singular_chain (Suc p) X ?d"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   984
      by (metis assms singular_chain_singleton)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   985
    moreover have "chain_boundary (Suc p) ?d = c"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   986
      by (simp add: assms scd chain_boundary_of_singleton [of X a "Suc p"] b frag_extend_cmul \<open>odd p\<close>)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   987
    ultimately show ?thesis
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   988
      by metis
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
   989
  qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   990
  with True assms show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   991
    by (auto simp: singular_boundary chain_boundary_of_singleton)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   992
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   993
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   994
  with assms singular_boundary_imp_chain show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   995
    by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   996
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   997
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   998
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   999
lemma singular_boundary_eq_cycle_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1000
  assumes "topspace X = {a}" "1 \<le> p"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1001
  shows "singular_relboundary p X {} c \<longleftrightarrow> singular_relcycle p X {} c" (is "?lhs = ?rhs")
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1002
proof
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1003
  show "?lhs \<Longrightarrow> ?rhs"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1004
    by (simp add: singular_relboundary_imp_relcycle)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1005
  show "?rhs \<Longrightarrow> ?lhs"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1006
    by (metis assms not_one_le_zero singular_boundary_singleton singular_cycle_singleton)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1007
qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1008
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1009
lemma singular_boundary_set_eq_cycle_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1010
  assumes "topspace X = {a}" "1 \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1011
  shows "singular_relboundary_set p X {} = singular_relcycle_set p X {}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1012
  using singular_boundary_eq_cycle_singleton [OF assms]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1013
  by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1014
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1015
subsection\<open>Simplicial chains\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1016
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1017
text\<open>Simplicial chains, effectively those resulting from linear maps.
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1018
 We still allow the map to be singular, so the name is questionable.
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1019
These are intended as building-blocks for singular subdivision, rather  than as a axis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1020
for 1 simplicial homology.\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1021
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1022
definition oriented_simplex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1023
  where "oriented_simplex p l \<equiv> (\<lambda>x\<in>standard_simplex p. \<lambda>i. (\<Sum>j\<le>p. l j i * x j))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1024
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1025
definition simplicial_simplex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1026
  where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1027
 "simplicial_simplex p S f \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1028
        singular_simplex p (subtopology (powertop_real UNIV) S) f \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1029
        (\<exists>l. f = oriented_simplex p l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1030
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1031
lemma simplicial_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1032
  "simplicial_simplex p S f \<longleftrightarrow> f ` (standard_simplex p) \<subseteq> S \<and> (\<exists>l. f = oriented_simplex p l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1033
  (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1034
proof
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1035
  assume R: ?rhs  
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1036
  have "continuous_map (subtopology (powertop_real UNIV) (standard_simplex p))
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1037
                (powertop_real UNIV) (\<lambda>x i. \<Sum>j\<le>p. l j i * x j)" for l :: " nat \<Rightarrow> 'a \<Rightarrow> real"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1038
    unfolding continuous_map_componentwise
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1039
    by (force intro: continuous_intros continuous_map_from_subtopology continuous_map_product_projection)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1040
  with R show ?lhs
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1041
    unfolding simplicial_simplex_def singular_simplex_subtopology
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1042
    by (auto simp add: singular_simplex_def oriented_simplex_def)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1043
qed (simp add: simplicial_simplex_def singular_simplex_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1044
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1045
lemma simplicial_simplex_empty [simp]: "\<not> simplicial_simplex p {} f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1046
  by (simp add: nonempty_standard_simplex simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1047
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1048
definition simplicial_chain
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1049
  where "simplicial_chain p S c \<equiv> Poly_Mapping.keys c \<subseteq> Collect (simplicial_simplex p S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1050
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1051
lemma simplicial_chain_0 [simp]: "simplicial_chain p S 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1052
  by (simp add: simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1053
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1054
lemma simplicial_chain_of [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1055
   "simplicial_chain p S (frag_of c) \<longleftrightarrow> simplicial_simplex p S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1056
  by (simp add: simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1057
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1058
lemma simplicial_chain_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1059
   "simplicial_chain p S c \<Longrightarrow> simplicial_chain p S (frag_cmul a c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1060
  by (auto simp: simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1061
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1062
lemma simplicial_chain_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1063
   "\<lbrakk>simplicial_chain p S c1; simplicial_chain p S c2\<rbrakk> \<Longrightarrow> simplicial_chain p S (c1 - c2)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1064
  unfolding simplicial_chain_def  by (meson UnE keys_diff subset_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1065
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1066
lemma simplicial_chain_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1067
   "(\<And>i. i \<in> I \<Longrightarrow> simplicial_chain p S (f i)) \<Longrightarrow> simplicial_chain p S (sum f I)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1068
  unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1069
  using order_trans [OF keys_sum [of f I]]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1070
  by (simp add: UN_least)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1071
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1072
lemma simplicial_simplex_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1073
   "simplicial_simplex p S (oriented_simplex p l)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1074
    \<longleftrightarrow> ((\<lambda>x i. \<Sum>j\<le>p. l j i * x j) ` standard_simplex p \<subseteq> S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1075
  by (auto simp: simplicial_simplex oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1076
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1077
lemma simplicial_imp_singular_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1078
   "simplicial_simplex p S f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1079
      \<Longrightarrow> singular_simplex p (subtopology (powertop_real UNIV) S) f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1080
  by (simp add: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1081
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1082
lemma simplicial_imp_singular_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1083
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1084
      \<Longrightarrow> singular_chain p (subtopology (powertop_real UNIV) S) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1085
  unfolding simplicial_chain_def singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1086
  by (auto intro: simplicial_imp_singular_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1087
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1088
lemma oriented_simplex_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1089
  "oriented_simplex p l = oriented_simplex p l' \<longleftrightarrow> (\<forall>i. i \<le> p \<longrightarrow> l i = l' i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1090
  (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1091
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1092
  assume L: ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1093
  show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1094
  proof clarify
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1095
    fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1096
    assume "i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1097
    let ?fi = "(\<lambda>j. if j = i then 1 else 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1098
    have "(\<Sum>j\<le>p. l j k * ?fi j) = (\<Sum>j\<le>p. l' j k * ?fi j)" for k
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1099
      using L \<open>i \<le> p\<close>
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1100
      by (simp add: fun_eq_iff oriented_simplex_def split: if_split_asm)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1101
    with \<open>i \<le> p\<close> show "l i = l' i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1102
      by (simp add: if_distrib ext cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1103
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1104
qed (auto simp: oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1105
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1106
lemma singular_face_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1107
  assumes "1 \<le> p" "k \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1108
  shows "singular_face p k (oriented_simplex p l) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1109
         oriented_simplex (p -1) (\<lambda>j. if j < k then l j else l (Suc j))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1110
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1111
  have "(\<Sum>j\<le>p. l j i * simplical_face k x j)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1112
      = (\<Sum>j\<le>p - Suc 0. (if j < k then l j else l (Suc j)) i * x j)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1113
    if "x \<in> standard_simplex (p - Suc 0)" for i x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1114
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1115
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1116
      unfolding simplical_face_def
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1117
      using sum.zero_middle [OF assms, where 'a=real, symmetric]
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1118
      by (simp add: if_distrib [of "\<lambda>x. _ * x"] if_distrib [of "\<lambda>f. f i * _"] atLeast0AtMost cong: if_cong)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1119
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1120
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1121
    using simplical_face_in_standard_simplex assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1122
    by (auto simp: singular_face_def oriented_simplex_def restrict_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1123
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1124
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1125
lemma simplicial_simplex_singular_face:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1126
  fixes f :: "(nat \<Rightarrow> real) \<Rightarrow> nat \<Rightarrow> real"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1127
  assumes ss: "simplicial_simplex p S f" and p: "1 \<le> p" "k \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1128
  shows "simplicial_simplex (p - Suc 0) S (singular_face p k f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1129
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1130
  let ?X = "subtopology (powertop_real UNIV) S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1131
  obtain m where l: "singular_simplex p ?X (oriented_simplex p m)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1132
       and feq: "f = oriented_simplex p m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1133
    using assms by (force simp: simplicial_simplex_def)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1134
  moreover   
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1135
  have "singular_face p k f = oriented_simplex (p - Suc 0) (\<lambda>i. if i < k then m i else m (Suc i))"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1136
    unfolding feq singular_face_def oriented_simplex_def
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1137
    apply (simp add: simplical_face_in_standard_simplex [OF p] restrict_compose_left subset_eq)
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1138
    using sum.zero_middle [OF p, where 'a=real, symmetric]  unfolding simplical_face_def o_def
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1139
    apply (simp add: if_distrib [of "\<lambda>x. _ * x"] if_distrib [of "\<lambda>f. f _ * _"] atLeast0AtMost cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1140
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1141
  ultimately
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1142
  show ?thesis
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1143
    using p simplicial_simplex_def singular_simplex_singular_face by blast
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1144
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1145
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1146
lemma simplicial_chain_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1147
   "simplicial_chain p S c \<Longrightarrow> simplicial_chain (p -1) S (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1148
  unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1149
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1150
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1151
  then have "simplicial_simplex p S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1152
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1153
  have "simplicial_chain (p - Suc 0) S (frag_of (singular_face p i f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1154
    if "0 < p" "i \<le> p" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1155
    using that one
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1156
    by (force simp: simplicial_simplex_def singular_simplex_singular_face singular_face_oriented_simplex)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1157
  then have "simplicial_chain (p - Suc 0) S (chain_boundary p (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1158
    unfolding chain_boundary_def frag_extend_of
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1159
    by (auto intro!: simplicial_chain_cmul simplicial_chain_sum)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1160
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1161
    by (simp add: simplicial_chain_def [symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1162
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1163
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1164
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1165
    by (metis chain_boundary_diff simplicial_chain_def simplicial_chain_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1166
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1167
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1168
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1169
subsection\<open>The cone construction on simplicial simplices.\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1170
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1171
consts simplex_cone :: "[nat, nat \<Rightarrow> real, [nat \<Rightarrow> real, nat] \<Rightarrow> real, nat \<Rightarrow> real, nat] \<Rightarrow> real"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1172
specification (simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1173
  simplex_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1174
    "\<And>p v l. simplex_cone p v (oriented_simplex p l) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1175
          oriented_simplex (Suc p) (\<lambda>i. if i = 0 then v else l(i -1))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1176
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1177
  have *: "\<And>x. \<exists>y. \<forall>v. (\<lambda>l. oriented_simplex (Suc x) (\<lambda>i. if i = 0 then v else l (i -1)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1178
                  = (y v \<circ> (oriented_simplex x))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1179
    apply (subst choice_iff [symmetric])
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1180
    by (simp add: oriented_simplex_eq  choice_iff [symmetric] function_factors_left [symmetric])
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1181
  then show ?thesis
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1182
    unfolding o_def by (metis(no_types))
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1183
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1184
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1185
lemma simplicial_simplex_simplex_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1186
  assumes f: "simplicial_simplex p S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1187
    and T: "\<And>x u. \<lbrakk>0 \<le> u; u \<le> 1; x \<in> S\<rbrakk> \<Longrightarrow> (\<lambda>i. (1 - u) * v i + u * x i) \<in> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1188
  shows "simplicial_simplex (Suc p) T (simplex_cone p v f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1189
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1190
  obtain l where l: "\<And>x. x \<in> standard_simplex p \<Longrightarrow> oriented_simplex p l x \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1191
    and feq: "f = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1192
    using f by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1193
  have "oriented_simplex p l x \<in> S" if "x \<in> standard_simplex p" for x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1194
    using f that by (auto simp: simplicial_simplex feq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1195
  then have S: "\<And>x. \<lbrakk>\<And>i. 0 \<le> x i \<and> x i \<le> 1; \<And>i. i>p \<Longrightarrow> x i = 0; sum x {..p} = 1\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1196
                 \<Longrightarrow> (\<lambda>i. \<Sum>j\<le>p. l j i * x j) \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1197
    by (simp add: oriented_simplex_def standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1198
  have "oriented_simplex (Suc p) (\<lambda>i. if i = 0 then v else l (i -1)) x \<in> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1199
    if "x \<in> standard_simplex (Suc p)" for x
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 70097
diff changeset
  1200
  proof (simp add: that oriented_simplex_def sum.atMost_Suc_shift del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1201
    have x01: "\<And>i. 0 \<le> x i \<and> x i \<le> 1" and x0: "\<And>i. i > Suc p \<Longrightarrow> x i = 0" and x1: "sum x {..Suc p} = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1202
      using that by (auto simp: oriented_simplex_def standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1203
    obtain a where "a \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1204
      using f by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1205
    show "(\<lambda>i. v i * x 0 + (\<Sum>j\<le>p. l j i * x (Suc j))) \<in> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1206
    proof (cases "x 0 = 1")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1207
      case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1208
      then have "sum x {Suc 0..Suc p} = 0"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1209
        using x1 by (simp add: atMost_atLeast0 sum.atLeast_Suc_atMost)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1210
      then have [simp]: "x (Suc j) = 0" if "j\<le>p" for j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1211
        unfolding sum.atLeast_Suc_atMost_Suc_shift
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1212
        using x01 that by (simp add: sum_nonneg_eq_0_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1213
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1214
        using T [of 0 a] \<open>a \<in> S\<close> by (auto simp: True)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1215
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1216
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1217
      then have "(\<lambda>i. v i * x 0 + (\<Sum>j\<le>p. l j i * x (Suc j))) = (\<lambda>i. (1 - (1 - x 0)) * v i + (1 - x 0) * (inverse (1 - x 0) * (\<Sum>j\<le>p. l j i * x (Suc j))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1218
        by (force simp: field_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1219
      also have "\<dots> \<in> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1220
      proof (rule T)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1221
        have "x 0 < 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1222
          by (simp add: False less_le x01)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1223
        have xle: "x (Suc i) \<le> (1 - x 0)" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1224
        proof (cases "i \<le> p")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1225
          case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1226
          have "sum x {0, Suc i} \<le> sum x {..Suc p}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1227
            by (rule sum_mono2) (auto simp: True x01)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1228
          then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1229
           using x1 x01 by (simp add: algebra_simps not_less)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1230
        qed (simp add: x0 x01)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1231
        have "(\<lambda>i. (\<Sum>j\<le>p. l j i * (x (Suc j) * inverse (1 - x 0)))) \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1232
        proof (rule S)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1233
          have "x 0 + (\<Sum>j\<le>p. x (Suc j)) = sum x {..Suc p}"
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 70097
diff changeset
  1234
            by (metis sum.atMost_Suc_shift)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1235
          with x1 have "(\<Sum>j\<le>p. x (Suc j)) = 1 - x 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1236
            by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1237
          with False show "(\<Sum>j\<le>p. x (Suc j) * inverse (1 - x 0)) = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1238
            by (metis add_diff_cancel_left' diff_diff_eq2 diff_zero right_inverse sum_distrib_right)
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70178
diff changeset
  1239
      qed (use x01 x0 xle \<open>x 0 < 1\<close> in \<open>auto simp: field_split_simps\<close>)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1240
      then show "(\<lambda>i. inverse (1 - x 0) * (\<Sum>j\<le>p. l j i * x (Suc j))) \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1241
        by (simp add: field_simps sum_divide_distrib)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1242
    qed (use x01 in auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1243
    finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1244
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1245
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1246
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1247
    by (auto simp: simplicial_simplex feq  simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1248
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1249
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1250
definition simplicial_cone
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1251
  where "simplicial_cone p v \<equiv> frag_extend (frag_of \<circ> simplex_cone p v)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1252
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1253
lemma simplicial_chain_simplicial_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1254
  assumes c: "simplicial_chain p S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1255
    and T: "\<And>x u. \<lbrakk>0 \<le> u; u \<le> 1; x \<in> S\<rbrakk> \<Longrightarrow> (\<lambda>i. (1 - u) * v i + u * x i) \<in> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1256
  shows "simplicial_chain (Suc p) T (simplicial_cone p v c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1257
  using c unfolding simplicial_chain_def simplicial_cone_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1258
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1259
  case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1260
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1261
    by (simp add: T simplicial_simplex_simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1262
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1263
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1264
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1265
    by (metis frag_extend_diff simplicial_chain_def simplicial_chain_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1266
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1267
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1268
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1269
lemma chain_boundary_simplicial_cone_of':
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1270
  assumes "f = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1271
  shows "chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1272
         frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1273
         - (if p = 0 then frag_of (\<lambda>u\<in>standard_simplex p. v)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1274
            else simplicial_cone (p -1) v (chain_boundary p (frag_of f)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1275
proof (simp, intro impI conjI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1276
  assume "p = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1277
  have eq: "(oriented_simplex 0 (\<lambda>j. if j = 0 then v else l j)) = (\<lambda>u\<in>standard_simplex 0. v)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1278
    by (force simp: oriented_simplex_def standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1279
  show "chain_boundary (Suc 0) (simplicial_cone 0 v (frag_of f))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1280
        = frag_of f - frag_of (\<lambda>u\<in>standard_simplex 0. v)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1281
    by (simp add: assms simplicial_cone_def chain_boundary_of \<open>p = 0\<close> simplex_cone singular_face_oriented_simplex eq cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1282
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1283
  assume "0 < p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1284
  have 0: "simplex_cone (p - Suc 0) v (singular_face p x (oriented_simplex p l))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1285
         = oriented_simplex p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1286
              (\<lambda>j. if j < Suc x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1287
                   then if j = 0 then v else l (j -1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1288
                   else if Suc j = 0 then v else l (Suc j -1))" if "x \<le> p" for x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1289
    using \<open>0 < p\<close> that
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1290
    by (auto simp: Suc_leI singular_face_oriented_simplex simplex_cone oriented_simplex_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1291
  have 1: "frag_extend (frag_of \<circ> simplex_cone (p - Suc 0) v)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1292
                     (\<Sum>k = 0..p. frag_cmul ((-1) ^ k) (frag_of (singular_face p k (oriented_simplex p l))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1293
         = - (\<Sum>k = Suc 0..Suc p. frag_cmul ((-1) ^ k)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1294
               (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l)))))"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1295
    unfolding sum.atLeast_Suc_atMost_Suc_shift
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1296
    by (auto simp: 0 simplex_cone singular_face_oriented_simplex frag_extend_sum frag_extend_cmul simp flip: sum_negf)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1297
  moreover have 2: "singular_face (Suc p) 0 (simplex_cone p v (oriented_simplex p l))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1298
                    = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1299
    by (simp add: simplex_cone singular_face_oriented_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1300
  show "chain_boundary (Suc p) (simplicial_cone p v (frag_of f))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1301
        = frag_of f - simplicial_cone (p - Suc 0) v (chain_boundary p (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1302
    using \<open>p > 0\<close>
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1303
    apply (simp add: assms simplicial_cone_def chain_boundary_of atMost_atLeast0 del: sum.atMost_Suc)
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1304
    apply (subst sum.atLeast_Suc_atMost [of 0])
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1305
     apply (simp_all add: 1 2 del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1306
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1307
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1308
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1309
lemma chain_boundary_simplicial_cone_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1310
  assumes "simplicial_simplex p S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1311
  shows "chain_boundary (Suc p) (simplicial_cone p v (frag_of f)) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1312
         frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1313
         - (if p = 0 then frag_of (\<lambda>u\<in>standard_simplex p. v)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1314
            else simplicial_cone (p -1) v (chain_boundary p (frag_of f)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1315
  using chain_boundary_simplicial_cone_of' assms unfolding simplicial_simplex_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1316
  by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1317
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1318
lemma chain_boundary_simplicial_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1319
  "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1320
   \<Longrightarrow> chain_boundary (Suc p) (simplicial_cone p v c) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1321
       c - (if p = 0 then frag_extend (\<lambda>f. frag_of (\<lambda>u\<in>standard_simplex p. v)) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1322
            else simplicial_cone (p -1) v (chain_boundary p c))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1323
  unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1324
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1325
  case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1326
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1327
    by (auto simp: chain_boundary_simplicial_cone_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1328
qed (auto simp: chain_boundary_diff simplicial_cone_def frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1329
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1330
lemma simplex_map_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1331
  assumes l: "simplicial_simplex p (standard_simplex q) (oriented_simplex p l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1332
    and g: "simplicial_simplex r S g" and "q \<le> r"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1333
  shows "simplex_map p g (oriented_simplex p l) = oriented_simplex p (g \<circ> l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1334
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1335
  obtain m where geq: "g = oriented_simplex r m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1336
    using g by (auto simp: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1337
  have "g (\<lambda>i. \<Sum>j\<le>p. l j i * x j) i = (\<Sum>j\<le>p. g (l j) i * x j)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1338
    if "x \<in> standard_simplex p" for x i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1339
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1340
    have ssr: "(\<lambda>i. \<Sum>j\<le>p. l j i * x j) \<in> standard_simplex r"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1341
      using l that standard_simplex_mono [OF \<open>q \<le> r\<close>]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1342
      unfolding simplicial_simplex_oriented_simplex by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1343
    have lss: "l j \<in> standard_simplex r" if "j\<le>p" for j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1344
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1345
      have q: "(\<lambda>x i. \<Sum>j\<le>p. l j i * x j) ` standard_simplex p \<subseteq> standard_simplex q"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1346
        using l by (simp add: simplicial_simplex_oriented_simplex)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1347
      let ?x = "(\<lambda>i. if i = j then 1 else 0)"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1348
      have p: "l j \<in> (\<lambda>x i. \<Sum>j\<le>p. l j i * x j) ` standard_simplex p"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1349
      proof
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1350
        show "l j = (\<lambda>i. \<Sum>j\<le>p. l j i * ?x j)"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1351
          using \<open>j\<le>p\<close> by (force simp: if_distrib cong: if_cong)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1352
        show "?x \<in> standard_simplex p"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1353
          by (simp add: that)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1354
      qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1355
      show ?thesis
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1356
        using standard_simplex_mono [OF \<open>q \<le> r\<close>] q p
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1357
        by blast
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1358
    qed
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1359
    have "g (\<lambda>i. \<Sum>j\<le>p. l j i * x j) i = (\<Sum>j\<le>r. \<Sum>n\<le>p. m j i * (l n j * x n))"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1360
      by (simp add: geq oriented_simplex_def sum_distrib_left ssr)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1361
    also have "... =  (\<Sum>j\<le>p. \<Sum>n\<le>r. m n i * (l j n * x j))"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1362
      by (rule sum.swap)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1363
    also have "... = (\<Sum>j\<le>p. g (l j) i * x j)"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1364
      by (simp add: geq oriented_simplex_def sum_distrib_right mult.assoc lss)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1365
    finally show ?thesis .
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1366
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1367
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1368
    by (force simp: oriented_simplex_def simplex_map_def o_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1369
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1370
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1371
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1372
lemma chain_map_simplicial_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1373
  assumes g: "simplicial_simplex r S g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1374
      and c: "simplicial_chain p (standard_simplex q) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1375
      and v: "v \<in> standard_simplex q" and "q \<le> r"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1376
  shows "chain_map (Suc p) g (simplicial_cone p v c) = simplicial_cone p (g v) (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1377
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1378
  have *: "simplex_map (Suc p) g (simplex_cone p v f) = simplex_cone p (g v) (simplex_map p g f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1379
    if "f \<in> Poly_Mapping.keys c" for f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1380
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1381
    have "simplicial_simplex p (standard_simplex q) f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1382
      using c that by (auto simp: simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1383
    then obtain m where feq: "f = oriented_simplex p m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1384
      by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1385
    have 0: "simplicial_simplex p (standard_simplex q) (oriented_simplex p m)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1386
      using \<open>simplicial_simplex p (standard_simplex q) f\<close> feq by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1387
    then have 1: "simplicial_simplex (Suc p) (standard_simplex q)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1388
                      (oriented_simplex (Suc p) (\<lambda>i. if i = 0 then v else m (i -1)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1389
      using convex_standard_simplex v
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1390
      by (simp flip: simplex_cone add: simplicial_simplex_simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1391
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1392
      using simplex_map_oriented_simplex [OF 1 g \<open>q \<le> r\<close>]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1393
            simplex_map_oriented_simplex [of p q m r S g, OF 0 g \<open>q \<le> r\<close>]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1394
      by (simp add: feq oriented_simplex_eq simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1395
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1396
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1397
    by (auto simp: chain_map_def simplicial_cone_def frag_extend_compose * intro: frag_extend_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1398
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1399
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1400
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1401
subsection\<open>Barycentric subdivision of a linear ("simplicial") simplex's image\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1402
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1403
definition simplicial_vertex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1404
  where "simplicial_vertex i f = f(\<lambda>j. if j = i then 1 else 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1405
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1406
lemma simplicial_vertex_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1407
   "simplicial_vertex i (oriented_simplex p l) = (if i \<le> p then l i else undefined)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1408
  by (simp add: simplicial_vertex_def oriented_simplex_def if_distrib cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1409
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1410
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1411
primrec simplicial_subdivision
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1412
where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1413
  "simplicial_subdivision 0 = id"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1414
| "simplicial_subdivision (Suc p) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1415
     frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1416
      (\<lambda>f. simplicial_cone p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1417
            (\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j f i) / (p + 2))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1418
            (simplicial_subdivision p (chain_boundary (Suc p) (frag_of f))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1419
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1420
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1421
lemma simplicial_subdivision_0 [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1422
   "simplicial_subdivision p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1423
  by (induction p) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1424
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1425
lemma simplicial_subdivision_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1426
   "simplicial_subdivision p (c1-c2) = simplicial_subdivision p c1 - simplicial_subdivision p c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1427
  by (induction p) (auto simp: frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1428
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1429
lemma simplicial_subdivision_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1430
   "simplicial_subdivision p (frag_of f) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1431
         (if p = 0 then frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1432
         else simplicial_cone (p -1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1433
               (\<lambda>i. (\<Sum>j\<le>p. simplicial_vertex j f i) / (Suc p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1434
               (simplicial_subdivision (p -1) (chain_boundary p (frag_of f))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1435
  by (induction p) (auto simp: add.commute)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1436
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1437
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1438
lemma simplicial_chain_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1439
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1440
           \<Longrightarrow> simplicial_chain p S (simplicial_subdivision p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1441
proof (induction p arbitrary: S c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1442
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1443
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1444
    using Suc.prems [unfolded simplicial_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1445
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1446
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1447
    then have f: "simplicial_simplex (Suc p) S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1448
      by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1449
    then have "simplicial_chain p (f ` standard_simplex (Suc p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1450
                 (simplicial_subdivision p (chain_boundary (Suc p) (frag_of f)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1451
      by (metis Suc.IH diff_Suc_1 simplicial_chain_boundary simplicial_chain_of simplicial_simplex subsetI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1452
    moreover
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1453
    obtain l where l: "\<And>x. x \<in> standard_simplex (Suc p) \<Longrightarrow> (\<lambda>i. (\<Sum>j\<le>Suc p. l j i * x j)) \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1454
      and feq: "f = oriented_simplex (Suc p) l"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1455
      using f by (fastforce simp: simplicial_simplex oriented_simplex_def simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1456
    have "(\<lambda>i. (1 - u) * ((\<Sum>j\<le>Suc p. simplicial_vertex j f i) / (real p + 2)) + u * y i) \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1457
      if "0 \<le> u" "u \<le> 1" and y: "y \<in> f ` standard_simplex (Suc p)" for y u
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1458
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1459
      obtain x where x: "x \<in> standard_simplex (Suc p)" and yeq: "y = oriented_simplex (Suc p) l x"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1460
        using y feq by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1461
      have "(\<lambda>i. \<Sum>j\<le>Suc p. l j i * ((if j \<le> Suc p then (1 - u) * inverse (p + 2) + u * x j else 0))) \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1462
      proof (rule l)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1463
        have "inverse (2 + real p) \<le> 1" "(2 + real p) * ((1 - u) * inverse (2 + real p)) + u = 1"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1464
          by (auto simp add: field_split_simps)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1465
        then show "(\<lambda>j. if j \<le> Suc p then (1 - u) * inverse (real (p + 2)) + u * x j else 0) \<in> standard_simplex (Suc p)"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1466
          using x \<open>0 \<le> u\<close> \<open>u \<le> 1\<close>
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1467
          by (simp add: sum.distrib standard_simplex_def linepath_le_1 flip: sum_distrib_left del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1468
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1469
      moreover have "(\<lambda>i. \<Sum>j\<le>Suc p. l j i * ((1 - u) * inverse (2 + real p) + u * x j))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1470
                   = (\<lambda>i. (1 - u) * (\<Sum>j\<le>Suc p. l j i) / (real p + 2) + u * (\<Sum>j\<le>Suc p. l j i * x j))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1471
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1472
        fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1473
        have "(\<Sum>j\<le>Suc p. l j i * ((1 - u) * inverse (2 + real p) + u * x j))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1474
            = (\<Sum>j\<le>Suc p. (1 - u) * l j i / (real p + 2) + u * l j i * x j)" (is "?lhs = _")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1475
          by (simp add: field_simps cong: sum.cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1476
        also have "\<dots> = (1 - u) * (\<Sum>j\<le>Suc p. l j i) / (real p + 2) + u * (\<Sum>j\<le>Suc p. l j i * x j)" (is "_ = ?rhs")
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1477
          by (simp add: sum_distrib_left sum.distrib sum_divide_distrib mult.assoc del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1478
        finally show "?lhs = ?rhs" .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1479
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1480
      ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1481
        using feq x yeq
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1482
        by (simp add: simplicial_vertex_oriented_simplex) (simp add: oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1483
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1484
    ultimately show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1485
      by (simp add: simplicial_chain_simplicial_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1486
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1487
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1488
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1489
      by (metis simplicial_chain_diff simplicial_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1490
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1491
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1492
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1493
lemma chain_boundary_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1494
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1495
    \<Longrightarrow> chain_boundary p (simplicial_subdivision p c) = simplicial_subdivision (p -1) (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1496
proof (induction p arbitrary: c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1497
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1498
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1499
    using Suc.prems [unfolded simplicial_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1500
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1501
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1502
    then have f: "simplicial_simplex (Suc p) S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1503
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1504
    then have "simplicial_chain p S (simplicial_subdivision p (chain_boundary (Suc p) (frag_of f)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1505
      by (metis diff_Suc_1 simplicial_chain_boundary simplicial_chain_of simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1506
    moreover have "simplicial_chain p S (chain_boundary (Suc p) (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1507
      using one simplicial_chain_boundary simplicial_chain_of by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1508
    moreover have "simplicial_subdivision (p - Suc 0) (chain_boundary p (chain_boundary (Suc p) (frag_of f))) = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1509
      by (metis f chain_boundary_boundary_alt simplicial_simplex_def simplicial_subdivision_0 singular_chain_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1510
    ultimately show ?case
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1511
      using chain_boundary_simplicial_cone Suc
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1512
      by (auto simp: chain_boundary_of frag_extend_diff simplicial_cone_def)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1513
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1514
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1515
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1516
      by (simp add: simplicial_subdivision_diff chain_boundary_diff frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1517
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1518
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1519
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1520
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1521
text \<open>A MESS AND USED ONLY ONCE\<close>
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1522
lemma simplicial_subdivision_shrinks:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1523
   "\<lbrakk>simplicial_chain p S c;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1524
     \<And>f x y. \<lbrakk>f \<in> Poly_Mapping.keys c; x \<in> standard_simplex p; y \<in> standard_simplex p\<rbrakk> \<Longrightarrow> \<bar>f x k - f y k\<bar> \<le> d;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1525
     f \<in> Poly_Mapping.keys(simplicial_subdivision p c);
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1526
     x \<in> standard_simplex p; y \<in> standard_simplex p\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1527
    \<Longrightarrow> \<bar>f x k - f y k\<bar> \<le> (p / (Suc p)) * d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1528
proof (induction p arbitrary: d c f x y)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1529
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1530
  define Sigp where "Sigp \<equiv> \<lambda>f:: (nat \<Rightarrow> real) \<Rightarrow> nat \<Rightarrow> real. \<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j f i) / real (p + 2)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1531
  let ?CB = "\<lambda>f. chain_boundary (Suc p) (frag_of f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1532
  have *: "Poly_Mapping.keys
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1533
             (simplicial_cone p (Sigp f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1534
               (simplicial_subdivision p (?CB f)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1535
           \<subseteq> {f. \<forall>x\<in>standard_simplex (Suc p). \<forall>y\<in>standard_simplex (Suc p).
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1536
                      \<bar>f x k - f y k\<bar> \<le> real (Suc p) / (real p + 2) * d}" (is "?lhs \<subseteq> ?rhs")
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1537
    if f: "f \<in> Poly_Mapping.keys c" for f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1538
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1539
    have ssf: "simplicial_simplex (Suc p) S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1540
      using Suc.prems(1) simplicial_chain_def that by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1541
    have 2: "\<And>x y. \<lbrakk>x \<in> standard_simplex (Suc p); y \<in> standard_simplex (Suc p)\<rbrakk> \<Longrightarrow> \<bar>f x k - f y k\<bar> \<le> d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1542
      by (meson Suc.prems(2) f subsetD le_Suc_eq order_refl standard_simplex_mono)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1543
    have sub: "Poly_Mapping.keys ((frag_of \<circ> simplex_cone p (Sigp f)) g) \<subseteq> ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1544
      if "g \<in> Poly_Mapping.keys (simplicial_subdivision p (?CB f))" for g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1545
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1546
      have 1: "simplicial_chain p S (?CB f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1547
        using ssf simplicial_chain_boundary simplicial_chain_of by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1548
      have "simplicial_chain (Suc p) (f ` standard_simplex(Suc p)) (frag_of f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1549
        by (metis simplicial_chain_of simplicial_simplex ssf subset_refl)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1550
      then have sc_sub: "Poly_Mapping.keys (?CB f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1551
                         \<subseteq> Collect (simplicial_simplex p (f ` standard_simplex (Suc p)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1552
        by (metis diff_Suc_1 simplicial_chain_boundary simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1553
      have led: "\<And>h x y. \<lbrakk>h \<in> Poly_Mapping.keys (chain_boundary (Suc p) (frag_of f));
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1554
                          x \<in> standard_simplex p; y \<in> standard_simplex p\<rbrakk> \<Longrightarrow> \<bar>h x k - h y k\<bar> \<le> d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1555
        using Suc.prems(2) f sc_sub
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1556
        by (simp add: simplicial_simplex subset_iff image_iff) metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1557
      have "\<And>f' x y. \<lbrakk>f' \<in> Poly_Mapping.keys (simplicial_subdivision p (?CB f)); x \<in> standard_simplex p; y \<in> standard_simplex p\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1558
            \<Longrightarrow> \<bar>f' x k - f' y k\<bar> \<le> (p / (Suc p)) * d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1559
        by (blast intro: led Suc.IH [of "chain_boundary (Suc p) (frag_of f)", OF 1])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1560
      then have g: "\<And>x y. \<lbrakk>x \<in> standard_simplex p; y \<in> standard_simplex p\<rbrakk> \<Longrightarrow> \<bar>g x k - g y k\<bar> \<le> (p / (Suc p)) * d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1561
        using that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1562
      have "d \<ge> 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1563
        using Suc.prems(2)[OF f] \<open>x \<in> standard_simplex (Suc p)\<close> by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1564
      have 3: "simplex_cone p (Sigp f) g \<in> ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1565
      proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1566
        have "simplicial_simplex p (f ` standard_simplex(Suc p)) g"
73932
fd21b4a93043 added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents: 73655
diff changeset
  1567
          by (metis (mono_tags, opaque_lifting) sc_sub mem_Collect_eq simplicial_chain_def simplicial_chain_simplicial_subdivision subsetD that)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1568
        then obtain m where m: "g ` standard_simplex p \<subseteq> f ` standard_simplex (Suc p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1569
          and geq: "g = oriented_simplex p m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1570
          using ssf by (auto simp: simplicial_simplex)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1571
        have m_in_gim: "m i \<in> g ` standard_simplex p" if "i \<le> p" for i
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1572
        proof 
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1573
          show "m i = g (\<lambda>j. if j = i then 1 else 0)"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1574
            by (simp add: geq oriented_simplex_def that if_distrib cong: if_cong)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1575
          show "(\<lambda>j. if j = i then 1 else 0) \<in> standard_simplex p"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1576
            by (simp add: oriented_simplex_def that)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1577
        qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1578
        obtain l where l: "f ` standard_simplex (Suc p) \<subseteq> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1579
          and feq: "f = oriented_simplex (Suc p) l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1580
          using ssf by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1581
        show ?thesis
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1582
        proof (clarsimp simp add: geq simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1583
          fix x y
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1584
          assume x: "x \<in> standard_simplex (Suc p)" and y: "y \<in> standard_simplex (Suc p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1585
          then have x': "(\<forall>i. 0 \<le> x i \<and> x i \<le> 1) \<and> (\<forall>i>Suc p. x i = 0) \<and> (\<Sum>i\<le>Suc p. x i) = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1586
            and y': "(\<forall>i. 0 \<le> y i \<and> y i \<le> 1) \<and> (\<forall>i>Suc p. y i = 0) \<and> (\<Sum>i\<le>Suc p. y i) = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1587
            by (auto simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1588
          have "\<bar>(\<Sum>j\<le>Suc p. (if j = 0 then \<lambda>i. (\<Sum>j\<le>Suc p. l j i) / (2 + real p) else m (j -1)) k * x j) -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1589
                 (\<Sum>j\<le>Suc p. (if j = 0 then \<lambda>i. (\<Sum>j\<le>Suc p. l j i) / (2 + real p) else m (j -1)) k * y j)\<bar>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1590
                \<le> (1 + real p) * d / (2 + real p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1591
          proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1592
            have zero: "\<bar>m (s - Suc 0) k - (\<Sum>j\<le>Suc p. l j k) / (2 + real p)\<bar> \<le> (1 + real p) * d / (2 + real p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1593
              if "0 < s" and "s \<le> Suc p" for s
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1594
            proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1595
              have "m (s - Suc 0) \<in> f ` standard_simplex (Suc p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1596
                using m m_in_gim that(2) by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1597
              then obtain z where eq: "m (s - Suc 0) = (\<lambda>i. \<Sum>j\<le>Suc p. l j i * z j)" and z: "z \<in> standard_simplex (Suc p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1598
                using feq unfolding oriented_simplex_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1599
              show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1600
                unfolding eq
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1601
              proof (rule convex_sum_bound_le)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1602
                fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1603
                assume i: "i \<in> {..Suc p}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1604
                then have [simp]: "card ({..Suc p} - {i}) = Suc p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1605
                  by (simp add: card_Suc_Diff1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1606
                have "(\<Sum>j\<le>Suc p. \<bar>l i k / (p + 2) - l j k / (p + 2)\<bar>) = (\<Sum>j\<le>Suc p. \<bar>l i k - l j k\<bar> / (p + 2))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1607
                  by (rule sum.cong) (simp_all add: flip: diff_divide_distrib)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1608
                also have "\<dots> = (\<Sum>j \<in> {..Suc p} - {i}. \<bar>l i k - l j k\<bar> / (p + 2))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1609
                  by (rule sum.mono_neutral_right) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1610
                also have "\<dots> \<le> (1 + real p) * d / (p + 2)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1611
                proof (rule sum_bounded_above_divide)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1612
                  fix i' :: "nat"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1613
                  assume i': "i' \<in> {..Suc p} - {i}"
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1614
                  have lf: "l r \<in> f ` standard_simplex(Suc p)" if "r \<le> Suc p" for r
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1615
                  proof
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1616
                    show "l r = f (\<lambda>j. if j = r then 1 else 0)"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1617
                      using that by (simp add: feq oriented_simplex_def if_distrib cong: if_cong)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1618
                    show "(\<lambda>j. if j = r then 1 else 0) \<in> standard_simplex (Suc p)"
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1619
                      by (auto simp: oriented_simplex_def that)
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1620
                  qed
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1621
                  show "\<bar>l i k - l i' k\<bar> / real (p + 2) \<le> (1 + real p) * d / real (p + 2) / real (card ({..Suc p} - {i}))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1622
                    using i i' lf [of i] lf [of i'] 2
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70178
diff changeset
  1623
                    by (auto simp: image_iff divide_simps)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1624
                qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1625
                finally have "(\<Sum>j\<le>Suc p. \<bar>l i k / (p + 2) - l j k / (p + 2)\<bar>) \<le> (1 + real p) * d / (p + 2)" .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1626
                then have "\<bar>\<Sum>j\<le>Suc p. l i k / (p + 2) - l j k / (p + 2)\<bar> \<le> (1 + real p) * d / (p + 2)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1627
                  by (rule order_trans [OF sum_abs])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1628
                then show "\<bar>l i k - (\<Sum>j\<le>Suc p. l j k) / (2 + real p)\<bar> \<le> (1 + real p) * d / (2 + real p)"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1629
                  by (simp add: sum_subtractf sum_divide_distrib del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1630
              qed (use standard_simplex_def z in auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1631
            qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1632
            have nonz: "\<bar>m (s - Suc 0) k - m (r - Suc 0) k\<bar> \<le> (1 + real p) * d / (2 + real p)" (is "?lhs \<le> ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1633
              if "r < s" and "0 < r" and "r \<le> Suc p" and "s \<le> Suc p" for r s
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1634
            proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1635
              have "?lhs \<le> (p / (Suc p)) * d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1636
                using m_in_gim [of "r - Suc 0"] m_in_gim [of "s - Suc 0"] that g by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1637
              also have "\<dots> \<le> ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1638
                by (simp add: field_simps \<open>0 \<le> d\<close>)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1639
              finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1640
            qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1641
            have jj: "j \<le> Suc p \<and> j' \<le> Suc p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1642
                \<longrightarrow> \<bar>(if j' = 0 then \<lambda>i. (\<Sum>j\<le>Suc p. l j i) / (2 + real p) else m (j' -1)) k -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1643
                     (if j = 0 then \<lambda>i. (\<Sum>j\<le>Suc p. l j i) / (2 + real p) else m (j -1)) k\<bar>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1644
                     \<le> (1 + real p) * d / (2 + real p)" for j j'
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1645
              using \<open>0 \<le> d\<close> 
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1646
              by (rule_tac a=j and b = "j'" in linorder_less_wlog; force simp: zero nonz simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1647
            show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1648
              apply (rule convex_sum_bound_le)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1649
              using x' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1650
              using x' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1651
              apply (subst abs_minus_commute)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1652
              apply (rule convex_sum_bound_le)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1653
              using y' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1654
              using y' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1655
              using jj by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1656
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1657
          then show "\<bar>simplex_cone p (Sigp f) (oriented_simplex p m) x k - simplex_cone p (Sigp f) (oriented_simplex p m) y k\<bar>
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1658
                \<le> (1 + real p) * d / (real p + 2)"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1659
            apply (simp add: feq Sigp_def simplicial_vertex_oriented_simplex simplex_cone del: sum.atMost_Suc)
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  1660
            apply (simp add: oriented_simplex_def algebra_simps x y del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1661
            done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1662
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1663
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1664
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1665
        using Suc.IH [OF 1, where f=g] 2 3 by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1666
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1667
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1668
      unfolding simplicial_chain_def simplicial_cone_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1669
      by (simp add: order_trans [OF keys_frag_extend] sub UN_subset_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1670
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1671
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1672
    using Suc
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1673
    apply (simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1674
    apply (drule subsetD [OF keys_frag_extend])
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1675
    apply (simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1676
    apply clarify (*OBTAIN?*)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1677
    apply (rename_tac FFF)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1678
    using *
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1679
    apply (simp add: add.commute Sigp_def subset_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1680
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1681
qed (auto simp: standard_simplex_0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1682
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1683
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1684
subsection\<open>Singular subdivision\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1685
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1686
definition singular_subdivision
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1687
  where "singular_subdivision p \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1688
        frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1689
           (\<lambda>f. chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1690
                  (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1691
                         (frag_of(restrict id (standard_simplex p)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1692
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1693
lemma singular_subdivision_0 [simp]: "singular_subdivision p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1694
  by (simp add: singular_subdivision_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1695
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1696
lemma singular_subdivision_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1697
   "singular_subdivision p (a + b) = singular_subdivision p a + singular_subdivision p b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1698
  by (simp add: singular_subdivision_def frag_extend_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1699
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1700
lemma singular_subdivision_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1701
   "singular_subdivision p (a - b) = singular_subdivision p a - singular_subdivision p b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1702
  by (simp add: singular_subdivision_def frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1703
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1704
lemma simplicial_simplex_id [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1705
   "simplicial_simplex p S (restrict id (standard_simplex p)) \<longleftrightarrow> standard_simplex p \<subseteq> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1706
    (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1707
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1708
  assume ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1709
  then show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1710
    by (simp add: simplicial_simplex_def singular_simplex_def continuous_map_in_subtopology set_mp)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1711
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1712
  assume R: ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1713
  then have cm: "continuous_map
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1714
                 (subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1715
                 (subtopology (powertop_real UNIV) S) id"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1716
    using continuous_map_from_subtopology_mono continuous_map_id by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1717
  moreover have "\<exists>l. restrict id (standard_simplex p) = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1718
    apply (rule_tac x="\<lambda>i j. if i = j then 1 else 0" in exI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1719
    apply (force simp: oriented_simplex_def standard_simplex_def if_distrib [of "\<lambda>u. u * _"] cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1720
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1721
  ultimately show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1722
    by (simp add: simplicial_simplex_def singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1723
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1724
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1725
lemma singular_chain_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1726
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1727
        \<Longrightarrow> singular_chain p X (singular_subdivision p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1728
  unfolding singular_subdivision_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1729
  apply (rule singular_chain_extend)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1730
  apply (rule singular_chain_chain_map [where X = "subtopology (powertop_real UNIV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1731
                          (standard_simplex p)"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1732
  apply (simp add: simplicial_chain_simplicial_subdivision simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1733
  by (simp add: singular_chain_def singular_simplex_def subset_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1734
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1735
lemma naturality_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1736
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1737
    \<Longrightarrow> singular_subdivision p (chain_map p g c) = chain_map p g (singular_subdivision p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1738
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1739
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1740
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1741
  then have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1742
    by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1743
  have "\<lbrakk>simplicial_chain p (standard_simplex p) d\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1744
    \<Longrightarrow> chain_map p (simplex_map p g f) d = chain_map p g (chain_map p f d)" for d
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1745
    unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1746
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1747
    case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1748
    then have "simplex_map p (simplex_map p g f) x = simplex_map p g (simplex_map p f x)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1749
      by (force simp: simplex_map_def restrict_compose_left simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1750
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1751
      by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1752
  qed (auto simp: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1753
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1754
    using simplicial_chain_simplicial_subdivision [of p "standard_simplex p" "frag_of (restrict id (standard_simplex p))"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1755
    by (simp add: singular_subdivision_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1756
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1757
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1758
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1759
    by (simp add: chain_map_diff singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1760
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1761
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1762
lemma simplicial_chain_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1763
  assumes f: "simplicial_simplex q X f" and c: "simplicial_chain p (standard_simplex q) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1764
  shows "simplicial_chain p X (chain_map p f c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1765
  using c unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1766
proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1767
  case (one g)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1768
  have "\<exists>n. simplex_map p (oriented_simplex q l)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1769
                 (oriented_simplex p m) = oriented_simplex p n"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1770
    if m: "singular_simplex p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1771
                (subtopology (powertop_real UNIV) (standard_simplex q)) (oriented_simplex p m)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1772
    for l m
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1773
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1774
    have "(\<lambda>i. \<Sum>j\<le>p. m j i * x j) \<in> standard_simplex q"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1775
      if "x \<in> standard_simplex p" for x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1776
      using that m unfolding oriented_simplex_def singular_simplex_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1777
      by (auto simp: continuous_map_in_subtopology image_subset_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1778
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1779
      unfolding oriented_simplex_def simplex_map_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1780
      apply (rule_tac x="\<lambda>j k. (\<Sum>i\<le>q. l i k * m j i)" in exI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1781
      apply (force simp: sum_distrib_left sum_distrib_right mult.assoc intro: sum.swap)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1782
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1783
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1784
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1785
    using f one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1786
    apply (auto simp: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1787
    apply (rule singular_simplex_simplex_map
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1788
        [where X = "subtopology (powertop_real UNIV) (standard_simplex q)"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1789
    unfolding singular_simplex_def apply (fastforce simp add:)+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1790
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1791
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1792
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1793
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1794
    by (metis chain_map_diff simplicial_chain_def simplicial_chain_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1795
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1796
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1797
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1798
lemma singular_subdivision_simplicial_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1799
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1800
           \<Longrightarrow> singular_subdivision p c = simplicial_subdivision p c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1801
proof (induction p arbitrary: S c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1802
  case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1803
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1804
    unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1805
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1806
    case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1807
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1808
      using singular_simplex_chain_map_id simplicial_imp_singular_simplex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1809
      by (fastforce simp: singular_subdivision_def simplicial_subdivision_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1810
  qed (auto simp: singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1811
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1812
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1813
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1814
    using Suc.prems unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1815
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1816
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1817
    then have ssf: "simplicial_simplex (Suc p) S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1818
      by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1819
    then have 1: "simplicial_chain p (standard_simplex (Suc p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1820
                   (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1821
                     (chain_boundary (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1822
                       (frag_of (restrict id (standard_simplex (Suc p))))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1823
      by (metis diff_Suc_1 order_refl simplicial_chain_boundary simplicial_chain_of simplicial_chain_simplicial_subdivision simplicial_simplex_id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1824
    have 2: "(\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j (restrict id (standard_simplex (Suc p))) i) / (real p + 2))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1825
                  \<in> standard_simplex (Suc p)"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1826
      by (simp add: simplicial_vertex_def standard_simplex_def del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1827
    have ss_Sp: "(\<lambda>i. (if i \<le> Suc p then 1 else 0) / (real p + 2)) \<in> standard_simplex (Suc p)"
70817
dd675800469d dedicated fact collections for algebraic simplification rules potentially splitting goals
haftmann
parents: 70178
diff changeset
  1828
      by (simp add: standard_simplex_def field_split_simps)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1829
    obtain l where feq: "f = oriented_simplex (Suc p) l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1830
      using one unfolding simplicial_simplex by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1831
    then have 3: "f (\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j (restrict id (standard_simplex (Suc p))) i) / (real p + 2))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1832
                = (\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j f i) / (real p + 2))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1833
      unfolding simplicial_vertex_def oriented_simplex_def
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1834
      by (simp add: ss_Sp if_distrib [of "\<lambda>x. _ * x"] sum_divide_distrib del: sum.atMost_Suc cong: if_cong)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1835
    have scp: "singular_chain (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1836
                 (subtopology (powertop_real UNIV) (standard_simplex (Suc p)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1837
                 (frag_of (restrict id (standard_simplex (Suc p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1838
      by (simp add: simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1839
    have scps: "simplicial_chain p (standard_simplex (Suc p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1840
                  (chain_boundary (Suc p) (frag_of (restrict id (standard_simplex (Suc p)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1841
      by (metis diff_Suc_1 order_refl simplicial_chain_boundary simplicial_chain_of simplicial_simplex_id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1842
    have scpf: "simplicial_chain p S
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1843
                 (chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1844
                   (chain_boundary (Suc p) (frag_of (restrict id (standard_simplex (Suc p))))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1845
      using scps simplicial_chain_chain_map ssf by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1846
    have 4: "chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1847
                (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1848
                   (chain_boundary (Suc p) (frag_of (restrict id (standard_simplex (Suc p))))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1849
           = simplicial_subdivision p (chain_boundary (Suc p) (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1850
      apply (simp add: chain_boundary_chain_map [OF scp] del: chain_map_of
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1851
          flip: singular_simplex_chain_map_id [OF simplicial_imp_singular_simplex [OF ssf]])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1852
      by (metis (no_types) scp singular_chain_boundary_alt Suc.IH [OF scps] Suc.IH [OF scpf] naturality_singular_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1853
    show ?case
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1854
      apply (simp add: singular_subdivision_def del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1855
      apply (simp only: ssf 1 2 3 4 chain_map_simplicial_cone [of "Suc p" S _ p "Suc p"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1856
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1857
  qed (auto simp: frag_extend_diff singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1858
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1859
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1860
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1861
lemma naturality_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1862
   "\<lbrakk>simplicial_chain p (standard_simplex q) c; simplicial_simplex q S g\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1863
    \<Longrightarrow> simplicial_subdivision p (chain_map p g c) = chain_map p g (simplicial_subdivision p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1864
apply (simp flip: singular_subdivision_simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1865
  by (metis naturality_singular_subdivision simplicial_chain_chain_map simplicial_imp_singular_chain singular_subdivision_simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1866
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1867
lemma chain_boundary_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1868
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1869
        \<Longrightarrow> chain_boundary p (singular_subdivision p c) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1870
            singular_subdivision (p - Suc 0) (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1871
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1872
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1873
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1874
    then have ssf: "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1875
      by (auto simp: singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1876
    then have scp: "simplicial_chain p (standard_simplex p) (frag_of (restrict id (standard_simplex p)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1877
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1878
    have scp1: "simplicial_chain (p - Suc 0) (standard_simplex p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1879
                  (chain_boundary p (frag_of (restrict id (standard_simplex p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1880
      using simplicial_chain_boundary by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1881
    have sgp1: "singular_chain (p - Suc 0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1882
                   (subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1883
                   (chain_boundary p (frag_of (restrict id (standard_simplex p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1884
      using scp1 simplicial_imp_singular_chain by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1885
    have scpp: "singular_chain p (subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1886
                  (frag_of (restrict id (standard_simplex p)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1887
      using scp simplicial_imp_singular_chain by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1888
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1889
      unfolding singular_subdivision_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1890
      using chain_boundary_chain_map [of p "subtopology (powertop_real UNIV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1891
                              (standard_simplex p)" _ f]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1892
      apply (simp add: simplicial_chain_simplicial_subdivision
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1893
          simplicial_imp_singular_chain chain_boundary_simplicial_subdivision [OF scp]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1894
          flip: singular_subdivision_simplicial_simplex [OF scp1] naturality_singular_subdivision [OF sgp1])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1895
      by (metis (full_types)   singular_subdivision_def  chain_boundary_chain_map [OF scpp] singular_simplex_chain_map_id [OF ssf])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1896
qed (auto simp: singular_subdivision_def frag_extend_diff chain_boundary_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1897
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1898
lemma singular_subdivision_zero:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1899
  "singular_chain 0 X c \<Longrightarrow> singular_subdivision 0 c = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1900
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1901
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1902
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1903
  then have "restrict (f \<circ> restrict id (standard_simplex 0)) (standard_simplex 0) = f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1904
    by (simp add: extensional_restrict restrict_compose_right singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1905
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1906
    by (auto simp: singular_subdivision_def simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1907
qed (auto simp: singular_subdivision_def frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1908
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1909
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1910
primrec subd where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1911
  "subd 0 = (\<lambda>x. 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1912
| "subd (Suc p) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1913
      frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1914
       (\<lambda>f. simplicial_cone (Suc p) (\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j f i) / real (Suc p + 1))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1915
               (simplicial_subdivision (Suc p) (frag_of f) - frag_of f -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1916
                subd p (chain_boundary (Suc p) (frag_of f))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1917
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1918
lemma subd_0 [simp]: "subd p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1919
  by (induction p) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1920
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1921
lemma subd_diff [simp]: "subd p (c1 - c2) = subd p c1 - subd p c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1922
  by (induction p) (auto simp: frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1923
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1924
lemma subd_uminus [simp]: "subd p (-c) = - subd p c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1925
  by (metis diff_0 subd_0 subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1926
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1927
lemma subd_power_uminus: "subd p (frag_cmul ((-1) ^ k) c) = frag_cmul ((-1) ^ k) (subd p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1928
  apply (induction k, simp_all)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1929
  by (metis minus_frag_cmul subd_uminus)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1930
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1931
lemma subd_power_sum: "subd p (sum f I) = sum (subd p \<circ> f) I"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1932
  apply (induction I rule: infinite_finite_induct)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1933
  by auto (metis add_diff_cancel_left' diff_add_cancel subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1934
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1935
lemma subd: "simplicial_chain p (standard_simplex s) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1936
     \<Longrightarrow> (\<forall>r g. simplicial_simplex s (standard_simplex r) g \<longrightarrow> chain_map (Suc p) g (subd p c) = subd p (chain_map p g c))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1937
         \<and> simplicial_chain (Suc p) (standard_simplex s) (subd p c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1938
         \<and> (chain_boundary (Suc p) (subd p c)) + (subd (p - Suc 0) (chain_boundary p c)) = (simplicial_subdivision p c) - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1939
proof (induction p arbitrary: c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1940
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1941
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1942
    using Suc.prems [unfolded simplicial_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1943
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1944
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1945
    then obtain l where l: "(\<lambda>x i. \<Sum>j\<le>Suc p. l j i * x j) ` standard_simplex (Suc p) \<subseteq> standard_simplex s"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1946
                  and feq: "f = oriented_simplex (Suc p) l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1947
      by (metis (mono_tags) mem_Collect_eq simplicial_simplex simplicial_simplex_oriented_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1948
    have scf: "simplicial_chain (Suc p) (standard_simplex s) (frag_of f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1949
      using one by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1950
    have lss: "l i \<in> standard_simplex s" if "i \<le> Suc p" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1951
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1952
      have "(\<lambda>i'. \<Sum>j\<le>Suc p. l j i' * (if j = i then 1 else 0)) \<in> standard_simplex s"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1953
        using subsetD [OF l] basis_in_standard_simplex that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1954
      moreover have "(\<lambda>i'. \<Sum>j\<le>Suc p. l j i' * (if j = i then 1 else 0)) = l i"
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  1955
        using that by (simp add: if_distrib [of "\<lambda>x. _ * x"] del: sum.atMost_Suc cong: if_cong)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1956
      ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1957
        by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1958
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1959
    have *: "(\<And>i. i \<le> n \<Longrightarrow> l i \<in> standard_simplex s)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1960
     \<Longrightarrow> (\<lambda>i. (\<Sum>j\<le>n. l j i) / (Suc n)) \<in> standard_simplex s" for n
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1961
    proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1962
      case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1963
      let ?x = "\<lambda>i. (1 - inverse (n + 2)) * ((\<Sum>j\<le>n. l j i) / (Suc n)) + inverse (n + 2) * l (Suc n) i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1964
      have "?x \<in> standard_simplex s"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1965
      proof (rule convex_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1966
        show "(\<lambda>i. (\<Sum>j\<le>n. l j i) / real (Suc n)) \<in> standard_simplex s"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1967
          using Suc by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1968
      qed (auto simp: lss Suc inverse_le_1_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1969
      moreover have "?x = (\<lambda>i. (\<Sum>j\<le>Suc n. l j i) / real (Suc (Suc n)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1970
        by (force simp: divide_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1971
      ultimately show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1972
        by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1973
    qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1974
    have **: "(\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j f i) / (2 + real p)) \<in> standard_simplex s"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1975
      using * [of "Suc p"] lss by (simp add: simplicial_vertex_oriented_simplex feq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1976
    show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1977
    proof (intro conjI impI allI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1978
      fix r g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1979
      assume g: "simplicial_simplex s (standard_simplex r) g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1980
      then obtain m where geq: "g = oriented_simplex s m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1981
        using simplicial_simplex by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1982
      have 1: "simplicial_chain (Suc p) (standard_simplex s) (simplicial_subdivision (Suc p) (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1983
        by (metis mem_Collect_eq one.hyps simplicial_chain_of simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1984
      have 2: "(\<Sum>j\<le>Suc p. \<Sum>i\<le>s. m i k * simplicial_vertex j f i)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1985
             = (\<Sum>j\<le>Suc p. simplicial_vertex j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1986
                                (simplex_map (Suc p) (oriented_simplex s m) f) k)" for k
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1987
      proof (rule sum.cong [OF refl])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1988
        fix j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1989
        assume j: "j \<in> {..Suc p}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1990
        have eq: "simplex_map (Suc p) (oriented_simplex s m) (oriented_simplex (Suc p) l)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1991
                = oriented_simplex (Suc p) (oriented_simplex s m \<circ> l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1992
        proof (rule simplex_map_oriented_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1993
          show "simplicial_simplex (Suc p) (standard_simplex s) (oriented_simplex (Suc p) l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1994
            using one by (simp add: feq flip: oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1995
          show "simplicial_simplex s (standard_simplex r) (oriented_simplex s m)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1996
            using g by (simp add: geq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1997
        qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1998
        show "(\<Sum>i\<le>s. m i k * simplicial_vertex j f i)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1999
            = simplicial_vertex j (simplex_map (Suc p) (oriented_simplex s m) f) k"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2000
          using one j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2001
          apply (simp add: feq eq simplicial_vertex_oriented_simplex simplicial_simplex_oriented_simplex image_subset_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2002
          apply (drule_tac x="(\<lambda>i. if i = j then 1 else 0)" in bspec)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2003
           apply (auto simp: oriented_simplex_def lss)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2004
          done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2005
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2006
      have 4: "chain_map (Suc p) g (subd p (chain_boundary (Suc p) (frag_of f)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2007
             = subd p (chain_boundary (Suc p) (frag_of (simplex_map (Suc p) g f)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2008
        by (metis (no_types) One_nat_def scf Suc.IH chain_boundary_chain_map chain_map_of diff_Suc_Suc diff_zero g simplicial_chain_boundary simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2009
      show "chain_map (Suc (Suc p)) g (subd (Suc p) (frag_of f)) = subd (Suc p) (chain_map (Suc p) g (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2010
        using g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2011
        apply (simp only: subd.simps frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2012
        apply (subst chain_map_simplicial_cone [of s "standard_simplex r" _ "Suc p" s], assumption)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2013
           apply (intro simplicial_chain_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2014
        using "1" apply auto[1]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2015
        using one.hyps apply auto[1]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2016
        apply (metis Suc.IH diff_Suc_1 mem_Collect_eq one.hyps simplicial_chain_boundary simplicial_chain_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2017
        using "**" apply auto[1]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2018
         apply (rule order_refl)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2019
         apply (simp only: chain_map_of frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2020
        apply (rule arg_cong2 [where f = "simplicial_cone (Suc p)"])
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  2021
         apply (simp add: geq sum_distrib_left oriented_simplex_def ** del: sum.atMost_Suc flip: sum_divide_distrib)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2022
        using 2  apply (simp only: oriented_simplex_def sum.swap [where A = "{..s}"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2023
        using naturality_simplicial_subdivision scf apply (fastforce simp add: 4 chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2024
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2025
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2026
      have sc: "simplicial_chain (Suc p) (standard_simplex s)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2027
               (simplicial_cone p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2028
                 (\<lambda>i. (\<Sum>j\<le>Suc p. simplicial_vertex j f i) / (Suc (Suc p)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2029
                 (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2030
                   (chain_boundary (Suc p) (frag_of f))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2031
          by (metis diff_Suc_1 nat.simps(3) simplicial_subdivision_of scf simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2032
      have ff: "simplicial_chain (Suc p) (standard_simplex s) (subd p (chain_boundary (Suc p) (frag_of f)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2033
        by (metis (no_types) Suc.IH diff_Suc_1 scf simplicial_chain_boundary)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2034
      show "simplicial_chain (Suc (Suc p)) (standard_simplex s) (subd (Suc p) (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2035
        using one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2036
        apply (simp only: subd.simps frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2037
        apply (rule_tac S="standard_simplex s" in simplicial_chain_simplicial_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2038
         apply (intro simplicial_chain_diff ff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2039
        using sc apply (simp add: algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2040
        using "**" convex_standard_simplex  apply force+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2041
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2042
      have "simplicial_chain p (standard_simplex s) (chain_boundary (Suc p) (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2043
        using scf simplicial_chain_boundary by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2044
      then have "chain_boundary (Suc p) (simplicial_subdivision (Suc p) (frag_of f) - frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2045
                                         - subd p (chain_boundary (Suc p) (frag_of f))) = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2046
        apply (simp only: chain_boundary_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2047
        using Suc.IH chain_boundary_boundary [of "Suc p" "subtopology (powertop_real UNIV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2048
                                (standard_simplex s)" "frag_of f"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2049
        by (metis One_nat_def add_diff_cancel_left' subd_0 chain_boundary_simplicial_subdivision plus_1_eq_Suc scf simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2050
      then show "chain_boundary (Suc (Suc p)) (subd (Suc p) (frag_of f))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2051
          + subd (Suc p - Suc 0) (chain_boundary (Suc p) (frag_of f))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2052
          = simplicial_subdivision (Suc p) (frag_of f) - frag_of f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2053
        apply (simp only: subd.simps frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2054
        apply (subst chain_boundary_simplicial_cone [of "Suc p" "standard_simplex s"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2055
         apply (meson ff scf simplicial_chain_diff simplicial_chain_simplicial_subdivision)
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  2056
        apply (simp add: simplicial_cone_def del: sum.atMost_Suc simplicial_subdivision.simps)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2057
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2058
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2059
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2060
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2061
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2062
      apply safe
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2063
        apply (metis chain_map_diff subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2064
       apply (metis simplicial_chain_diff subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2065
      apply (auto simp:  simplicial_subdivision_diff chain_boundary_diff
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2066
          simp del: simplicial_subdivision.simps subd.simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2067
      by (metis (no_types, lifting) add_diff_add add_uminus_conv_diff diff_0 diff_diff_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2068
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2069
qed simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2070
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2071
lemma chain_homotopic_simplicial_subdivision1:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2072
  "\<lbrakk>simplicial_chain p (standard_simplex q) c; simplicial_simplex q (standard_simplex r) g\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2073
       \<Longrightarrow> chain_map (Suc p) g (subd p c) = subd p (chain_map p g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2074
  by (simp add: subd)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2075
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2076
lemma chain_homotopic_simplicial_subdivision2:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2077
  "simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2078
       \<Longrightarrow> simplicial_chain (Suc p) (standard_simplex q) (subd p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2079
  by (simp add: subd)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2080
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2081
lemma chain_homotopic_simplicial_subdivision3:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2082
  "simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2083
   \<Longrightarrow> chain_boundary (Suc p) (subd p c) = (simplicial_subdivision p c) - c - subd (p - Suc 0) (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2084
  by (simp add: subd algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2085
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2086
lemma chain_homotopic_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2087
  "\<exists>h. (\<forall>p. h p 0 = 0) \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2088
       (\<forall>p c1 c2. h p (c1-c2) = h p c1 - h p c2) \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2089
       (\<forall>p q r g c.
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2090
                simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2091
                \<longrightarrow> simplicial_simplex q (standard_simplex r) g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2092
                \<longrightarrow> chain_map (Suc p) g (h p c) = h p (chain_map p g c)) \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2093
       (\<forall>p q c. simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2094
                \<longrightarrow> simplicial_chain (Suc p) (standard_simplex q) (h p c)) \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2095
       (\<forall>p q c. simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2096
                \<longrightarrow> chain_boundary (Suc p) (h p c) + h (p - Suc 0) (chain_boundary p c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2097
                  = (simplicial_subdivision p c) - c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2098
  by (rule_tac x=subd in exI) (fastforce simp: subd)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2099
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2100
lemma chain_homotopic_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2101
  obtains h where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2102
        "\<And>p. h p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2103
        "\<And>p c1 c2. h p (c1-c2) = h p c1 - h p c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2104
        "\<And>p X c. singular_chain p X c \<Longrightarrow> singular_chain (Suc p) X (h p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2105
        "\<And>p X c. singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2106
                 \<Longrightarrow> chain_boundary (Suc p) (h p c) + h (p - Suc 0) (chain_boundary p c) = singular_subdivision p c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2107
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2108
  define k where "k \<equiv> \<lambda>p. frag_extend (\<lambda>f:: (nat \<Rightarrow> real) \<Rightarrow> 'a. chain_map (Suc p) f (subd p (frag_of(restrict id (standard_simplex p)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2109
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2110
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2111
    fix p X and c :: "'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2112
    assume c: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2113
    have "singular_chain (Suc p) X (k p c) \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2114
               chain_boundary (Suc p) (k p c) + k (p - Suc 0) (chain_boundary p c) = singular_subdivision p c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2115
      using c [unfolded singular_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2116
    proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2117
      case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2118
      let ?X = "subtopology (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2119
      show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2120
      proof (simp add: k_def, intro conjI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2121
        show "singular_chain (Suc p) X (chain_map (Suc p) f (subd p (frag_of (restrict id (standard_simplex p)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2122
        proof (rule singular_chain_chain_map)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2123
          show "singular_chain (Suc p) ?X  (subd p (frag_of (restrict id (standard_simplex p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2124
            by (simp add: chain_homotopic_simplicial_subdivision2 simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2125
          show "continuous_map ?X X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2126
            using one.hyps singular_simplex_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2127
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2128
      next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2129
        have scp: "singular_chain (Suc p) ?X (subd p (frag_of (restrict id (standard_simplex p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2130
          by (simp add: chain_homotopic_simplicial_subdivision2 simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2131
        have feqf: "frag_of (simplex_map p f (restrict id (standard_simplex p))) = frag_of f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2132
          using one.hyps singular_simplex_chain_map_id by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2133
        have *: "chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2134
                   (subd (p - Suc 0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2135
                     (\<Sum>k\<le>p. frag_cmul ((-1) ^ k) (frag_of (singular_face p k id))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2136
              = (\<Sum>x\<le>p. frag_cmul ((-1) ^ x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2137
                         (chain_map p (singular_face p x f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2138
                           (subd (p - Suc 0) (frag_of (restrict id (standard_simplex (p - Suc 0)))))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2139
                  (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2140
                  if "p > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2141
        proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2142
          have eqc: "subd (p - Suc 0) (frag_of (singular_face p i id))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2143
                   = chain_map p (singular_face p i id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2144
                                 (subd (p - Suc 0) (frag_of (restrict id (standard_simplex (p - Suc 0)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2145
            if "i \<le> p" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2146
          proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2147
            have 1: "simplicial_chain (p - Suc 0) (standard_simplex (p - Suc 0))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2148
                       (frag_of (restrict id (standard_simplex (p - Suc 0))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2149
              by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2150
            have 2: "simplicial_simplex (p - Suc 0) (standard_simplex p) (singular_face p i id)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2151
              by (metis One_nat_def Suc_leI \<open>0 < p\<close> simplicial_simplex_id simplicial_simplex_singular_face singular_face_restrict subsetI that)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2152
            have 3: "simplex_map (p - Suc 0) (singular_face p i id) (restrict id (standard_simplex (p - Suc 0)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2153
                   = singular_face p i id"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2154
              by (force simp: simplex_map_def singular_face_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2155
            show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2156
              using chain_homotopic_simplicial_subdivision1 [OF 1 2]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2157
                that \<open>p > 0\<close>  by (simp add: 3)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2158
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2159
          have xx: "simplicial_chain p (standard_simplex(p - Suc 0))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2160
                    (subd (p - Suc 0) (frag_of (restrict id (standard_simplex (p - Suc 0)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2161
            by (metis Suc_pred chain_homotopic_simplicial_subdivision2 order_refl simplicial_chain_of simplicial_simplex_id that)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2162
          have yy: "\<And>k. k \<le> p \<Longrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2163
                 chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2164
                  (chain_map p (singular_face p k id) h) = chain_map p (singular_face p k f) h"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2165
            if "simplicial_chain p (standard_simplex(p - Suc 0)) h" for h
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2166
            using that unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2167
          proof (induction h rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2168
            case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2169
            then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2170
                using one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2171
              apply (simp add: chain_map_of singular_simplex_def simplicial_simplex_def, auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2172
                apply (rule_tac f=frag_of in arg_cong, rule)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2173
                apply (simp add: simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2174
                by (simp add: continuous_map_in_subtopology image_subset_iff singular_face_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2175
          qed (auto simp: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2176
          have "?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2177
                = chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2178
                      (\<Sum>k\<le>p. frag_cmul ((-1) ^ k)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2179
                          (chain_map p (singular_face p k id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2180
                           (subd (p - Suc 0) (frag_of (restrict id (standard_simplex (p - Suc 0)))))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2181
            by (simp add: subd_power_sum subd_power_uminus eqc)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2182
          also have "\<dots> = ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2183
            by (simp add: chain_map_sum xx yy)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2184
          finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2185
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2186
        have "chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2187
                   (simplicial_subdivision p (frag_of (restrict id (standard_simplex p)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2188
                   - subd (p - Suc 0) (chain_boundary p (frag_of (restrict id (standard_simplex p)))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2189
              = singular_subdivision p (frag_of f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2190
              - frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2191
                   (\<lambda>f. chain_map (Suc (p - Suc 0)) f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2192
                         (subd (p - Suc 0) (frag_of (restrict id (standard_simplex (p - Suc 0))))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2193
                   (chain_boundary p (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2194
          apply (simp add: singular_subdivision_def chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2195
          apply (clarsimp simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2196
          apply (simp add: frag_extend_sum frag_extend_cmul *)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2197
          done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2198
        then show "chain_boundary (Suc p) (chain_map (Suc p) f (subd p (frag_of (restrict id (standard_simplex p)))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2199
                 + frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2200
                   (\<lambda>f. chain_map (Suc (p - Suc 0)) f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2201
                         (subd (p - Suc 0) (frag_of (restrict id (standard_simplex (p - Suc 0))))))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2202
                   (chain_boundary p (frag_of f))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2203
                 = singular_subdivision p (frag_of f) - frag_of f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2204
          by (simp add: chain_boundary_chain_map [OF scp] chain_homotopic_simplicial_subdivision3 [where q=p] chain_map_diff feqf)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2205
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2206
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2207
      case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2208
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2209
        apply (simp only: k_def singular_chain_diff chain_boundary_diff frag_extend_diff singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2210
        by (metis (no_types, lifting) add_diff_add diff_add_cancel)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2211
    qed (auto simp: k_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2212
    then show "singular_chain (Suc p) X (k p c)" "chain_boundary (Suc p) (k p c) + k (p - Suc 0) (chain_boundary p c) = singular_subdivision p c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2213
        by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2214
  qed (auto simp: k_def frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2215
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2216
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2217
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2218
lemma homologous_rel_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2219
  assumes "singular_relcycle p X T c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2220
  shows "homologous_rel p X T (singular_subdivision p c) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2221
proof (cases "p = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2222
  case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2223
  with assms show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2224
    by (auto simp: singular_relcycle_def singular_subdivision_zero)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2225
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2226
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2227
  with assms show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2228
    unfolding homologous_rel_def singular_relboundary singular_relcycle
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2229
    by (metis One_nat_def Suc_diff_1 chain_homotopic_singular_subdivision gr_zeroI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2230
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2231
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2232
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2233
subsection\<open>Excision argument that we keep doing singular subdivision\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2234
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2235
lemma singular_subdivision_power_0 [simp]: "(singular_subdivision p ^^ n) 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2236
  by (induction n) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2237
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2238
lemma singular_subdivision_power_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2239
  "(singular_subdivision p ^^ n) (a - b) = (singular_subdivision p ^^ n) a - (singular_subdivision p ^^ n) b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2240
  by (induction n) (auto simp: singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2241
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2242
lemma iterated_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2243
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2244
        \<Longrightarrow> (singular_subdivision p ^^ n) c =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2245
            frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2246
             (\<lambda>f. chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2247
                       ((simplicial_subdivision p ^^ n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2248
                         (frag_of(restrict id (standard_simplex p))))) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2249
proof (induction n arbitrary: c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2250
  case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2251
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2252
    unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2253
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2254
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2255
    then have "restrict f (standard_simplex p) = f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2256
      by (simp add: extensional_restrict singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2257
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2258
      by (auto simp: simplex_map_def cong: restrict_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2259
  qed (auto simp: frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2260
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2261
  case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2262
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2263
    using Suc.prems unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2264
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2265
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2266
    then have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2267
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2268
    have scp: "simplicial_chain p (standard_simplex p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2269
                 ((simplicial_subdivision p ^^ n) (frag_of (restrict id (standard_simplex p))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2270
    proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2271
      case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2272
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2273
        by (metis funpow_0 order_refl simplicial_chain_of simplicial_simplex_id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2274
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2275
      case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2276
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2277
        by (simp add: simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2278
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2279
    have scnp: "simplicial_chain p (standard_simplex p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2280
                  ((simplicial_subdivision p ^^ n) (frag_of (\<lambda>x\<in>standard_simplex p. x)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2281
    proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2282
      case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2283
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2284
        by (metis eq_id_iff funpow_0 order_refl simplicial_chain_of simplicial_simplex_id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2285
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2286
      case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2287
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2288
        by (simp add: simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2289
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2290
    have sff: "singular_chain p X (frag_of f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2291
      by (simp add: \<open>singular_simplex p X f\<close> singular_chain_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2292
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2293
      using Suc.IH [OF sff] naturality_singular_subdivision [OF simplicial_imp_singular_chain [OF scp], of f] singular_subdivision_simplicial_simplex [OF scnp]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2294
      by (simp add: singular_chain_of id_def del: restrict_apply)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2295
  qed (auto simp: singular_subdivision_power_diff singular_subdivision_diff frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2296
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2297
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2298
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2299
lemma chain_homotopic_iterated_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2300
  obtains h where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2301
        "\<And>p. h p 0 = (0 :: 'a chain)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2302
        "\<And>p c1 c2. h p (c1-c2) = h p c1 - h p c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2303
        "\<And>p X c. singular_chain p X c \<Longrightarrow> singular_chain (Suc p) X (h p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2304
        "\<And>p X c. singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2305
                 \<Longrightarrow> chain_boundary (Suc p) (h p c) + h (p - Suc 0) (chain_boundary p c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2306
                   = (singular_subdivision p ^^ n) c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2307
proof (induction n arbitrary: thesis)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2308
  case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2309
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2310
    by (rule 0 [of "(\<lambda>p x. 0)"]) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2311
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2312
  case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2313
  then obtain k where k:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2314
        "\<And>p. k p 0 = (0 :: 'a chain)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2315
        "\<And>p c1 c2. k p (c1-c2) = k p c1 - k p c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2316
        "\<And>p X c. singular_chain p X c \<Longrightarrow> singular_chain (Suc p) X (k p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2317
        "\<And>p X c. singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2318
                 \<Longrightarrow> chain_boundary (Suc p) (k p c) + k (p - Suc 0) (chain_boundary p c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2319
                     = (singular_subdivision p ^^ n) c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2320
    by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2321
  obtain h where h:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2322
        "\<And>p. h p 0 = (0 :: 'a chain)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2323
        "\<And>p c1 c2. h p (c1-c2) = h p c1 - h p c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2324
        "\<And>p X c. singular_chain p X c \<Longrightarrow> singular_chain (Suc p) X (h p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2325
        "\<And>p X c. singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2326
                 \<Longrightarrow> chain_boundary (Suc p) (h p c) + h (p - Suc 0) (chain_boundary p c) = singular_subdivision p c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2327
    by (blast intro: chain_homotopic_singular_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2328
  let ?h = "(\<lambda>p c. singular_subdivision (Suc p) (k p c) + h p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2329
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2330
  proof (rule Suc.prems)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2331
    fix p X and c :: "'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2332
    assume "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2333
    then show "singular_chain (Suc p) X (?h p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2334
      by (simp add: h k singular_chain_add singular_chain_singular_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2335
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2336
    fix p :: "nat" and X :: "'a topology" and c :: "'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2337
    assume sc: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2338
    have f5: "chain_boundary (Suc p) (singular_subdivision (Suc p) (k p c)) = singular_subdivision p (chain_boundary (Suc p) (k p c))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2339
      using chain_boundary_singular_subdivision k(3) sc by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2340
    have [simp]: "singular_subdivision (Suc (p - Suc 0)) (k (p - Suc 0) (chain_boundary p c)) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2341
                  singular_subdivision p (k (p - Suc 0) (chain_boundary p c))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2342
    proof (cases p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2343
      case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2344
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2345
        by (simp add: k chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2346
    qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2347
    show "chain_boundary (Suc p) (?h p c) + ?h (p - Suc 0) (chain_boundary p c) = (singular_subdivision p ^^ Suc n) c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2348
      using chain_boundary_singular_subdivision [of "Suc p" X]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2349
      apply (simp add: chain_boundary_add f5 h k algebra_simps)
73655
26a1d66b9077 tuned proofs --- avoid z3, which is absent on arm64-linux;
wenzelm
parents: 72794
diff changeset
  2350
      apply (smt (verit, ccfv_threshold) add.commute add_diff_eq diff_add_cancel diff_diff_eq2 h(4) k(4) sc singular_subdivision_add)
26a1d66b9077 tuned proofs --- avoid z3, which is absent on arm64-linux;
wenzelm
parents: 72794
diff changeset
  2351
      done
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2352
  qed (auto simp: k h singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2353
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2354
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2355
lemma llemma:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2356
  assumes p: "standard_simplex p \<subseteq> \<Union>\<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2357
      and \<C>: "\<And>U. U \<in> \<C> \<Longrightarrow> openin (powertop_real UNIV) U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2358
  obtains d where "0 < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2359
                  "\<And>K. \<lbrakk>K \<subseteq> standard_simplex p;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2360
                        \<And>x y i. \<lbrakk>i \<le> p; x \<in> K; y \<in> K\<rbrakk> \<Longrightarrow> \<bar>x i - y i\<bar> \<le> d\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2361
                       \<Longrightarrow> \<exists>U. U \<in> \<C> \<and> K \<subseteq> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2362
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2363
  have "\<exists>e U. 0 < e \<and> U \<in> \<C> \<and> x \<in> U \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2364
                (\<forall>y. (\<forall>i\<le>p. \<bar>y i - x i\<bar> \<le> 2 * e) \<and> (\<forall>i>p. y i = 0) \<longrightarrow> y \<in> U)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2365
    if x: "x \<in> standard_simplex p" for x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2366
  proof-
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2367
    obtain U where U: "U \<in> \<C>" "x \<in> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2368
      using x p by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2369
    then obtain V where finV: "finite {i. V i \<noteq> UNIV}" and openV: "\<And>i. open (V i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2370
                  and xV: "x \<in> Pi\<^sub>E UNIV V" and UV: "Pi\<^sub>E UNIV V \<subseteq> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2371
      using \<C> unfolding openin_product_topology_alt by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2372
    have xVi: "x i \<in> V i" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2373
      using PiE_mem [OF xV] by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2374
    have "\<And>i. \<exists>e>0. \<forall>x'. \<bar>x' - x i\<bar> < e \<longrightarrow> x' \<in> V i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2375
      by (rule openV [unfolded open_real, rule_format, OF xVi])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2376
    then obtain d where d: "\<And>i. d i > 0" and dV: "\<And>i x'. \<bar>x' - x i\<bar> < d i \<Longrightarrow> x' \<in> V i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2377
      by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2378
    define e where "e \<equiv> Inf (insert 1 (d ` {i. V i \<noteq> UNIV})) / 3"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2379
    have ed3: "e \<le> d i / 3" if "V i \<noteq> UNIV" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2380
      using that finV by (auto simp: e_def intro: cInf_le_finite)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2381
    show "\<exists>e U. 0 < e \<and> U \<in> \<C> \<and> x \<in> U \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2382
                (\<forall>y. (\<forall>i\<le>p. \<bar>y i - x i\<bar> \<le> 2 * e) \<and> (\<forall>i>p. y i = 0) \<longrightarrow> y \<in> U)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2383
    proof (intro exI conjI allI impI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2384
      show "e > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2385
        using d finV by (simp add: e_def finite_less_Inf_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2386
      fix y assume y: "(\<forall>i\<le>p. \<bar>y i - x i\<bar> \<le> 2 * e) \<and> (\<forall>i>p. y i = 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2387
      have "y \<in> Pi\<^sub>E UNIV V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2388
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2389
        show "y i \<in> V i" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2390
        proof (cases "p < i")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2391
          case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2392
          then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2393
            by (metis (mono_tags, lifting) y x mem_Collect_eq standard_simplex_def xVi)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2394
        next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2395
          case False show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2396
          proof (cases "V i = UNIV")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2397
            case False show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2398
            proof (rule dV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2399
              have "\<bar>y i - x i\<bar> \<le> 2 * e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2400
                using y \<open>\<not> p < i\<close> by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2401
              also have "\<dots> < d i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2402
                using ed3 [OF False] \<open>e > 0\<close> by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2403
              finally show "\<bar>y i - x i\<bar> < d i" .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2404
            qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2405
          qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2406
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2407
      qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2408
      with UV show "y \<in> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2409
        by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2410
    qed (use U in auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2411
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2412
  then obtain e U where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2413
      eU: "\<And>x. x \<in> standard_simplex p \<Longrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2414
                0 < e x \<and> U x \<in> \<C> \<and> x \<in> U x"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2415
      and  UI: "\<And>x y. \<lbrakk>x \<in> standard_simplex p;  \<And>i. i \<le> p \<Longrightarrow> \<bar>y i - x i\<bar> \<le> 2 * e x; \<And>i. i > p \<Longrightarrow> y i = 0\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2416
                       \<Longrightarrow> y \<in> U x"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2417
    by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2418
  define F where "F \<equiv> \<lambda>x. Pi\<^sub>E UNIV (\<lambda>i. if i \<le> p then {x i - e x<..<x i + e x} else UNIV)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2419
  have "\<forall>S \<in> F ` standard_simplex p. openin (powertop_real UNIV) S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2420
    by (simp add: F_def openin_PiE_gen)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2421
  moreover have pF: "standard_simplex p \<subseteq> \<Union>(F ` standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2422
    by (force simp: F_def PiE_iff eU)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2423
  ultimately have "\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> F ` standard_simplex p \<and> standard_simplex p \<subseteq> \<Union>\<F>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2424
    using compactin_standard_simplex [of p]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2425
    unfolding compactin_def by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2426
  then obtain S where "finite S" and ssp: "S \<subseteq> standard_simplex p" "standard_simplex p \<subseteq> \<Union>(F ` S)"
70178
4900351361b0 Lindelöf spaces and supporting material
paulson <lp15@cam.ac.uk>
parents: 70113
diff changeset
  2427
    unfolding ex_finite_subset_image by (auto simp: ex_finite_subset_image)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2428
  then have "S \<noteq> {}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2429
    by (auto simp: nonempty_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2430
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2431
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2432
    show "Inf (e ` S) > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2433
      using \<open>finite S\<close> \<open>S \<noteq> {}\<close> ssp eU by (auto simp: finite_less_Inf_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2434
    fix k :: "(nat \<Rightarrow> real) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2435
    assume k: "k \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2436
         and kle: "\<And>x y i. \<lbrakk>i \<le> p; x \<in> k; y \<in> k\<rbrakk> \<Longrightarrow> \<bar>x i - y i\<bar> \<le> Inf (e ` S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2437
    show "\<exists>U. U \<in> \<C> \<and> k \<subseteq> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2438
    proof (cases "k = {}")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2439
      case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2440
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2441
        using \<open>S \<noteq> {}\<close> eU equals0I ssp(1) subset_eq p by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2442
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2443
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2444
      with k ssp obtain x a where "x \<in> k" "x \<in> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2445
                            and a: "a \<in> S" and Fa: "x \<in> F a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2446
        by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2447
      then have le_ea: "\<And>i. i \<le> p \<Longrightarrow> abs (x i - a i) < e a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2448
        by (simp add: F_def PiE_iff if_distrib abs_diff_less_iff cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2449
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2450
      proof (intro exI conjI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2451
        show "U a \<in> \<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2452
          using a eU ssp(1) by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2453
        show "k \<subseteq> U a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2454
        proof clarify
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2455
          fix y assume "y \<in> k"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2456
          with k have y: "y \<in> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2457
            by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2458
          show "y \<in> U a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2459
          proof (rule UI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2460
            show "a \<in> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2461
              using a ssp(1) by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2462
            fix i :: "nat"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2463
            assume "i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2464
            then have "\<bar>x i - y i\<bar> \<le> e a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2465
              by (meson kle [OF \<open>i \<le> p\<close>] a \<open>finite S\<close> \<open>x \<in> k\<close> \<open>y \<in> k\<close> cInf_le_finite finite_imageI imageI order_trans)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2466
            then show "\<bar>y i - a i\<bar> \<le> 2 * e a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2467
              using le_ea [OF \<open>i \<le> p\<close>] by linarith
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2468
          next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2469
            fix i assume "p < i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2470
            then show "y i = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2471
              using standard_simplex_def y by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2472
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2473
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2474
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2475
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2476
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2477
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2478
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2479
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2480
proposition sufficient_iterated_singular_subdivision_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2481
  assumes \<C>: "\<And>U. U \<in> \<C> \<Longrightarrow> openin X U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2482
      and X: "topspace X \<subseteq> \<Union>\<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2483
      and p: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2484
  obtains n where "\<And>m f. \<lbrakk>n \<le> m; f \<in> Poly_Mapping.keys ((singular_subdivision p ^^ m) c)\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2485
                      \<Longrightarrow> \<exists>V \<in> \<C>. f ` (standard_simplex p) \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2486
proof (cases "c = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2487
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2488
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2489
  proof (cases "topspace X = {}")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2490
    case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2491
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2492
      using p that by (force simp: singular_chain_empty True)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2493
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2494
    case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2495
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2496
    proof (cases "\<C> = {}")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2497
      case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2498
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2499
        using False X by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2500
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2501
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2502
      have "\<exists>e. 0 < e \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2503
                (\<forall>K. K \<subseteq> standard_simplex p \<longrightarrow> (\<forall>x y i. x \<in> K \<and> y \<in> K \<and> i \<le> p \<longrightarrow> \<bar>x i - y i\<bar> \<le> e)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2504
                     \<longrightarrow> (\<exists>V. V \<in> \<C> \<and> f ` K \<subseteq> V))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2505
        if f: "f \<in> Poly_Mapping.keys c" for f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2506
      proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2507
        have ssf: "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2508
          using f p by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2509
        then have fp: "\<And>x. x \<in> standard_simplex p \<Longrightarrow> f x \<in> topspace X"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2510
          by (auto simp: singular_simplex_def image_subset_iff dest: continuous_map_image_subset_topspace)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2511
        have "\<exists>T. openin (powertop_real UNIV) T \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2512
                    standard_simplex p \<inter> f -` V = T \<inter> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2513
          if V: "V \<in> \<C>" for V
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2514
        proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2515
          have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2516
            using p f unfolding singular_chain_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2517
          then have "openin (subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2518
                            {x \<in> standard_simplex p. f x \<in> V}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2519
            using \<C> [OF \<open>V \<in> \<C>\<close>] by (simp add: singular_simplex_def continuous_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2520
          moreover have "standard_simplex p \<inter> f -` V = {x \<in> standard_simplex p. f x \<in> V}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2521
            by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2522
          ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2523
            by (simp add: openin_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2524
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2525
        then obtain g where gope: "\<And>V. V \<in> \<C> \<Longrightarrow> openin (powertop_real UNIV) (g V)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2526
                and geq: "\<And>V. V \<in> \<C> \<Longrightarrow> standard_simplex p \<inter> f -` V = g V \<inter> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2527
          by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2528
        obtain d where "0 < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2529
              and d: "\<And>K. \<lbrakk>K \<subseteq> standard_simplex p; \<And>x y i. \<lbrakk>i \<le> p; x \<in> K; y \<in> K\<rbrakk> \<Longrightarrow> \<bar>x i - y i\<bar> \<le> d\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2530
                       \<Longrightarrow> \<exists>U. U \<in> g ` \<C> \<and> K \<subseteq> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2531
        proof (rule llemma [of p "g ` \<C>"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2532
          show "standard_simplex p \<subseteq> \<Union>(g ` \<C>)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2533
            using geq X fp by (fastforce simp add:)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2534
          show "openin (powertop_real UNIV) U" if "U \<in> g ` \<C>" for U :: "(nat \<Rightarrow> real) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2535
            using gope that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2536
        qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2537
        show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2538
        proof (rule exI, intro allI conjI impI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2539
          fix K :: "(nat \<Rightarrow> real) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2540
          assume K: "K \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2541
             and Kd: "\<forall>x y i. x \<in> K \<and> y \<in> K \<and> i \<le> p \<longrightarrow> \<bar>x i - y i\<bar> \<le> d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2542
          then have "\<exists>U. U \<in> g ` \<C> \<and> K \<subseteq> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2543
            using d [OF K] by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2544
          then show "\<exists>V. V \<in> \<C> \<and> f ` K \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2545
            using K geq by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2546
        qed (rule \<open>d > 0\<close>)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2547
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2548
      then obtain \<psi> where epos: "\<forall>f \<in> Poly_Mapping.keys c. 0 < \<psi> f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2549
                 and e: "\<And>f K. \<lbrakk>f \<in> Poly_Mapping.keys c; K \<subseteq> standard_simplex p;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2550
                                \<And>x y i. x \<in> K \<and> y \<in> K \<and> i \<le> p \<Longrightarrow> \<bar>x i - y i\<bar> \<le> \<psi> f\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2551
                               \<Longrightarrow> \<exists>V. V \<in> \<C> \<and> f ` K \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2552
        by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2553
      obtain d where "0 < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2554
               and d: "\<And>f K. \<lbrakk>f \<in> Poly_Mapping.keys c; K \<subseteq> standard_simplex p;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2555
                              \<And>x y i. \<lbrakk>x \<in> K; y \<in> K; i \<le> p\<rbrakk> \<Longrightarrow> \<bar>x i - y i\<bar> \<le> d\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2556
                              \<Longrightarrow> \<exists>V. V \<in> \<C> \<and> f ` K \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2557
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2558
        show "Inf (\<psi> ` Poly_Mapping.keys c) > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2559
          by (simp add: finite_less_Inf_iff \<open>c \<noteq> 0\<close> epos)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2560
        fix f K
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2561
        assume fK: "f \<in> Poly_Mapping.keys c" "K \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2562
          and le: "\<And>x y i. \<lbrakk>x \<in> K; y \<in> K; i \<le> p\<rbrakk> \<Longrightarrow> \<bar>x i - y i\<bar> \<le> Inf (\<psi> ` Poly_Mapping.keys c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2563
        then have lef: "Inf (\<psi> ` Poly_Mapping.keys c) \<le> \<psi> f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2564
          by (auto intro: cInf_le_finite)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2565
        show "\<exists>V. V \<in> \<C> \<and> f ` K \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2566
          using le lef by (blast intro: dual_order.trans e [OF fK])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2567
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2568
      let ?d = "\<lambda>m. (simplicial_subdivision p ^^ m) (frag_of (restrict id (standard_simplex p)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2569
      obtain n where n: "(p / (Suc p)) ^ n < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2570
        using real_arch_pow_inv \<open>0 < d\<close> by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2571
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2572
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2573
        fix m h
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2574
        assume "n \<le> m" and "h \<in> Poly_Mapping.keys ((singular_subdivision p ^^ m) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2575
        then obtain f where "f \<in> Poly_Mapping.keys c" "h \<in> Poly_Mapping.keys (chain_map p f (?d m))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2576
          using subsetD [OF keys_frag_extend] iterated_singular_subdivision [OF p, of m] by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2577
        then obtain g where g: "g \<in> Poly_Mapping.keys (?d m)" and heq: "h = restrict (f \<circ> g) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2578
          using keys_frag_extend by (force simp: chain_map_def simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2579
        have xx: "simplicial_chain p (standard_simplex p) (?d n) \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2580
                  (\<forall>f \<in> Poly_Mapping.keys(?d n). \<forall>x \<in> standard_simplex p. \<forall>y \<in> standard_simplex p.
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2581
                       \<bar>f x i - f y i\<bar> \<le> (p / (Suc p)) ^ n)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2582
          for n i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2583
        proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2584
          case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2585
          have "simplicial_simplex p (standard_simplex p) (\<lambda>a\<in>standard_simplex p. a)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2586
            by (metis eq_id_iff order_refl simplicial_simplex_id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2587
          moreover have "(\<forall>x\<in>standard_simplex p. \<forall>y\<in>standard_simplex p. \<bar>x i - y i\<bar> \<le> 1)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2588
            unfolding standard_simplex_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2589
            by (auto simp: abs_if dest!: spec [where x=i])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2590
          ultimately show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2591
            unfolding power_0 funpow_0 by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2592
        next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2593
          case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2594
          show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2595
            unfolding power_Suc funpow.simps o_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2596
          proof (intro conjI ballI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2597
            show "simplicial_chain p (standard_simplex p) (simplicial_subdivision p (?d n))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2598
              by (simp add: Suc simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2599
            show "\<bar>f x i - f y i\<bar> \<le> real p / real (Suc p) * (real p / real (Suc p)) ^ n"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2600
              if "f \<in> Poly_Mapping.keys (simplicial_subdivision p (?d n))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2601
                and "x \<in> standard_simplex p" and "y \<in> standard_simplex p" for f x y
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2602
              using Suc that by (blast intro: simplicial_subdivision_shrinks)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2603
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2604
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2605
        have "g ` standard_simplex p \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2606
          using g xx [of m] unfolding simplicial_chain_def simplicial_simplex by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2607
        moreover
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2608
        have "\<bar>g x i - g y i\<bar> \<le> d" if "i \<le> p" "x \<in> standard_simplex p" "y \<in> standard_simplex p" for x y i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2609
        proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2610
          have "\<bar>g x i - g y i\<bar> \<le> (p / (Suc p)) ^ m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2611
            using g xx [of m] that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2612
          also have "\<dots> \<le> (p / (Suc p)) ^ n"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2613
            by (auto intro: power_decreasing [OF \<open>n \<le> m\<close>])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2614
          finally show ?thesis using n by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2615
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2616
        then have "\<bar>x i - y i\<bar> \<le> d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2617
          if "x \<in> g ` (standard_simplex p)" "y \<in> g ` (standard_simplex p)" "i \<le> p" for i x y
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2618
          using that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2619
        ultimately show "\<exists>V\<in>\<C>. h ` standard_simplex p \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2620
          using \<open>f \<in> Poly_Mapping.keys c\<close> d [of f "g ` standard_simplex p"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2621
          by (simp add: Bex_def heq image_image)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2622
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2623
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2624
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2625
qed force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2626
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2627
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2628
lemma small_homologous_rel_relcycle_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2629
  assumes \<C>: "\<And>U. U \<in> \<C> \<Longrightarrow> openin X U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2630
      and X: "topspace X \<subseteq> \<Union>\<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2631
      and p: "singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2632
    obtains c' where "singular_relcycle p X S c'" "homologous_rel p X S c c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2633
                      "\<And>f. f \<in> Poly_Mapping.keys c' \<Longrightarrow> \<exists>V \<in> \<C>. f ` (standard_simplex p) \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2634
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2635
  have "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2636
       "(chain_boundary p c, 0) \<in> (mod_subset (p - Suc 0) (subtopology X S))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2637
    using p unfolding singular_relcycle_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2638
  then obtain n where n: "\<And>m f. \<lbrakk>n \<le> m; f \<in> Poly_Mapping.keys ((singular_subdivision p ^^ m) c)\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2639
                            \<Longrightarrow> \<exists>V \<in> \<C>. f ` (standard_simplex p) \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2640
    by (blast intro: sufficient_iterated_singular_subdivision_exists [OF \<C> X])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2641
  let ?c' = "(singular_subdivision p ^^ n) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2642
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2643
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2644
    show "homologous_rel p X S c ?c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2645
      apply (induction n, simp_all)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2646
      by (metis p homologous_rel_singular_subdivision homologous_rel_singular_relcycle homologous_rel_trans homologous_rel_sym)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2647
    then show "singular_relcycle p X S ?c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2648
      by (metis homologous_rel_singular_relcycle p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2649
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2650
    fix f :: "(nat \<Rightarrow> real) \<Rightarrow> 'a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2651
    assume "f \<in> Poly_Mapping.keys ?c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2652
    then show "\<exists>V\<in>\<C>. f ` standard_simplex p \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2653
      by (rule n [OF order_refl])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2654
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2655
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2656
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2657
lemma excised_chain_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2658
  fixes S :: "'a set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2659
  assumes "X closure_of U \<subseteq> X interior_of T" "T \<subseteq> S" "singular_chain p (subtopology X S) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2660
  obtains n d e where "singular_chain p (subtopology X (S - U)) d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2661
                      "singular_chain p (subtopology X T) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2662
                      "(singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2663
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2664
  have *: "\<exists>n d e. singular_chain p (subtopology X (S - U)) d \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2665
                  singular_chain p (subtopology X T) e \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2666
                  (singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2667
    if c: "singular_chain p (subtopology X S) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2668
       and X: "X closure_of U \<subseteq> X interior_of T" "U \<subseteq> topspace X" and S: "T \<subseteq> S" "S \<subseteq> topspace X"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2669
       for p X c S and T U :: "'a set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2670
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2671
    obtain n where n: "\<And>m f. \<lbrakk>n \<le> m; f \<in> Poly_Mapping.keys ((singular_subdivision p ^^ m) c)\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2672
                             \<Longrightarrow> \<exists>V \<in> {S \<inter> X interior_of T, S - X closure_of U}. f ` standard_simplex p \<subseteq> V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2673
      apply (rule sufficient_iterated_singular_subdivision_exists
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2674
                   [of "{S \<inter> X interior_of T, S - X closure_of U}"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2675
      using X S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2676
      by (auto simp: topspace_subtopology openin_subtopology_Int2 openin_subtopology_diff_closed)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2677
    let ?c' = "\<lambda>n. (singular_subdivision p ^^ n) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2678
    have "singular_chain p (subtopology X S) (?c' m)" for m
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2679
      by (induction m) (auto simp: singular_chain_singular_subdivision c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2680
    then have scp: "singular_chain p (subtopology X S) (?c' n)" .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2681
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2682
    have SS: "Poly_Mapping.keys (?c' n) \<subseteq> singular_simplex_set p (subtopology X (S - U))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2683
                              \<union> singular_simplex_set p (subtopology X T)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2684
    proof (clarsimp)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2685
      fix f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2686
      assume f: "f \<in> Poly_Mapping.keys ((singular_subdivision p ^^ n) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2687
         and non: "\<not> singular_simplex p (subtopology X T) f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2688
      show "singular_simplex p (subtopology X (S - U)) f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2689
        using n [OF order_refl f] scp f non closure_of_subset [OF \<open>U \<subseteq> topspace X\<close>] interior_of_subset [of X T]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2690
        by (fastforce simp: image_subset_iff singular_simplex_subtopology singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2691
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2692
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2693
       unfolding singular_chain_def using frag_split [OF SS] by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2694
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2695
  have "(subtopology X (topspace X \<inter> S)) = (subtopology X S)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2696
    by (metis subtopology_subtopology subtopology_topspace)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2697
  with assms have c: "singular_chain p (subtopology X (topspace X \<inter> S)) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2698
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2699
  have Xsub: "X closure_of (topspace X \<inter> U) \<subseteq> X interior_of (topspace X \<inter> T)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2700
    using assms closure_of_restrict interior_of_restrict by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2701
  obtain n d e where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2702
    d: "singular_chain p (subtopology X (topspace X \<inter> S - topspace X \<inter> U)) d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2703
    and e: "singular_chain p (subtopology X (topspace X \<inter> T)) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2704
    and de: "(singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2705
    using *[OF c Xsub, simplified] assms by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2706
  show thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2707
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2708
    show "singular_chain p (subtopology X (S - U)) d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2709
      by (metis d Diff_Int_distrib inf.cobounded2 singular_chain_mono)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2710
    show "singular_chain p (subtopology X T) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2711
      by (metis e inf.cobounded2 singular_chain_mono)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2712
    show "(singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2713
      by (rule de)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2714
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2715
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2716
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2717
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2718
lemma excised_relcycle_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2719
  fixes S :: "'a set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2720
  assumes X: "X closure_of U \<subseteq> X interior_of T" and "T \<subseteq> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2721
      and c: "singular_relcycle p (subtopology X S) T c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2722
  obtains c' where "singular_relcycle p (subtopology X (S - U)) (T - U) c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2723
                   "homologous_rel p (subtopology X S) T c c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2724
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2725
  have [simp]: "(S - U) \<inter> (T - U) = T - U" "S \<inter> T = T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2726
    using \<open>T \<subseteq> S\<close> by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2727
  have scc: "singular_chain p (subtopology X S) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2728
    and scp1: "singular_chain (p - Suc 0) (subtopology X T) (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2729
    using c by (auto simp: singular_relcycle_def mod_subset_def subtopology_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2730
  obtain n d e where d: "singular_chain p (subtopology X (S - U)) d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2731
    and e: "singular_chain p (subtopology X T) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2732
    and de: "(singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2733
    using excised_chain_exists [OF X \<open>T \<subseteq> S\<close> scc] .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2734
  have scSUd: "singular_chain (p - Suc 0) (subtopology X (S - U)) (chain_boundary p d)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2735
    by (simp add: singular_chain_boundary d)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2736
  have sccn: "singular_chain p (subtopology X S) ((singular_subdivision p ^^ n) c)" for n
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2737
    by (induction n) (auto simp: singular_chain_singular_subdivision scc)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2738
  have "singular_chain (p - Suc 0) (subtopology X T) (chain_boundary p ((singular_subdivision p ^^ n) c))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2739
  proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2740
    case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2741
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2742
      by (simp add: singular_chain_singular_subdivision chain_boundary_singular_subdivision [OF sccn])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2743
  qed (auto simp: scp1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2744
  then have "singular_chain (p - Suc 0) (subtopology X T) (chain_boundary p ((singular_subdivision p ^^ n) c - e))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2745
    by (simp add: chain_boundary_diff singular_chain_diff singular_chain_boundary e)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2746
  with de have scTd: "singular_chain (p - Suc 0) (subtopology X T) (chain_boundary p d)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2747
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2748
  show thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2749
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2750
    have "singular_chain (p - Suc 0) X (chain_boundary p d)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2751
      using scTd singular_chain_subtopology by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2752
    with scSUd scTd have "singular_chain (p - Suc 0) (subtopology X (T - U)) (chain_boundary p d)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2753
      by (fastforce simp add: singular_chain_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2754
    then show "singular_relcycle p (subtopology X (S - U)) (T - U) d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2755
      by (auto simp: singular_relcycle_def mod_subset_def subtopology_subtopology d)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2756
    have "homologous_rel p (subtopology X S) T (c-0) ((singular_subdivision p ^^ n) c - e)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2757
    proof (rule homologous_rel_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2758
      show "homologous_rel p (subtopology X S) T c ((singular_subdivision p ^^ n) c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2759
      proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2760
        case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2761
        then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2762
          apply simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2763
          apply (rule homologous_rel_trans)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2764
          using c homologous_rel_singular_relcycle_1 homologous_rel_singular_subdivision homologous_rel_sym by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2765
      qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2766
      show "homologous_rel p (subtopology X S) T 0 e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2767
        unfolding homologous_rel_def using e
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2768
        by (intro singular_relboundary_diff singular_chain_imp_relboundary; simp add: subtopology_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2769
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2770
    with de show "homologous_rel p (subtopology X S) T c d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2771
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2772
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2773
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2774
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2775
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2776
subsection\<open>Homotopy invariance\<close>
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2777
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2778
theorem homotopic_imp_homologous_rel_chain_maps:
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2779
  assumes hom: "homotopic_with (\<lambda>h. h ` T \<subseteq> V) S U f g" and c: "singular_relcycle p S T c"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2780
  shows "homologous_rel p U V (chain_map p f c) (chain_map p g c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2781
proof -
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  2782
  note sum.atMost_Suc [simp del]
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2783
  have contf: "continuous_map S U f" and contg: "continuous_map S U g"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2784
    using homotopic_with_imp_continuous_maps [OF hom] by metis+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2785
  obtain h where conth: "continuous_map (prod_topology (top_of_set {0..1::real}) S) U h"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2786
    and h0: "\<And>x. h(0, x) = f x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2787
    and h1: "\<And>x. h(1, x) = g x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2788
    and hV: "\<And>t x. \<lbrakk>0 \<le> t; t \<le> 1; x \<in> T\<rbrakk> \<Longrightarrow> h(t,x) \<in> V"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2789
    using hom by (fastforce simp: homotopic_with_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2790
  define vv where "vv \<equiv> \<lambda>j i. if i = Suc j then 1 else (0::real)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2791
  define ww where "ww \<equiv> \<lambda>j i. if i=0 \<or> i = Suc j then 1 else (0::real)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2792
  define simp where "simp \<equiv> \<lambda>q i. oriented_simplex (Suc q) (\<lambda>j. if j \<le> i then vv j else ww(j -1))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2793
  define pr where "pr \<equiv> \<lambda>q c. \<Sum>i\<le>q. frag_cmul ((-1) ^ i)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2794
                                        (frag_of (simplex_map (Suc q) (\<lambda>z. h(z 0, c(z \<circ> Suc))) (simp q i)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2795
  have ss_ss: "simplicial_simplex (Suc q) ({x. x 0 \<in> {0..1} \<and> (x \<circ> Suc) \<in> standard_simplex q}) (simp q i)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2796
    if "i \<le> q" for q i
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2797
  proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2798
    have "(\<Sum>j\<le>Suc q. (if j \<le> i then vv j 0 else ww (j -1) 0) * x j) \<in> {0..1}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2799
      if "x \<in> standard_simplex (Suc q)" for x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2800
    proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2801
      have "(\<Sum>j\<le>Suc q. if j \<le> i then 0 else x j) \<le> sum x {..Suc q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2802
        using that unfolding standard_simplex_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2803
        by (force intro!: sum_mono)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2804
      with \<open>i \<le> q\<close> that show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2805
        by (simp add: vv_def ww_def standard_simplex_def if_distrib [of "\<lambda>u. u * _"] sum_nonneg cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2806
    qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2807
    moreover
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2808
    have "(\<lambda>k. \<Sum>j\<le>Suc q. (if j \<le> i then vv j k else ww (j -1) k) * x j) \<circ> Suc \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2809
      if "x \<in> standard_simplex (Suc q)" for x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2810
    proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2811
      have card: "({..q} \<inter> {k. Suc k = j}) = {j-1}" if "0 < j" "j \<le> Suc q" for j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2812
        using that by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2813
      have eq: "(\<Sum>j\<le>Suc q. \<Sum>k\<le>q. if j \<le> i then if k = j then x j else 0 else if Suc k = j then x j else 0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2814
              = (\<Sum>j\<le>Suc q. x j)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2815
        by (rule sum.cong [OF refl]) (use \<open>i \<le> q\<close> in \<open>simp add: sum.If_cases card\<close>)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2816
      have "(\<Sum>j\<le>Suc q. if j \<le> i then if k = j then x j else 0 else if Suc k = j then x j else 0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2817
            \<le> sum x {..Suc q}" for k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2818
        using that unfolding standard_simplex_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2819
        by (force intro!: sum_mono)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2820
      then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2821
        using \<open>i \<le> q\<close> that
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2822
        by (simp add: vv_def ww_def standard_simplex_def if_distrib [of "\<lambda>u. u * _"] sum_nonneg
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2823
            sum.swap [where A = "atMost q"] eq cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2824
    qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2825
    ultimately show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2826
      by (simp add: that simplicial_simplex_oriented_simplex simp_def image_subset_iff if_distribR)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2827
  qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2828
  obtain prism where prism: "\<And>q. prism q 0 = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2829
    "\<And>q c. singular_chain q S c \<Longrightarrow> singular_chain (Suc q) U (prism q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2830
    "\<And>q c. singular_chain q (subtopology S T) c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2831
                           \<Longrightarrow> singular_chain (Suc q) (subtopology U V) (prism q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2832
    "\<And>q c. singular_chain q S c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2833
                           \<Longrightarrow> chain_boundary (Suc q) (prism q c) =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2834
                               chain_map q g c - chain_map q f c - prism (q -1) (chain_boundary q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2835
  proof
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2836
    show "(frag_extend \<circ> pr) q 0 = 0" for q
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2837
      by (simp add: pr_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2838
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2839
    show "singular_chain (Suc q) U ((frag_extend \<circ> pr) q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2840
      if "singular_chain q S c" for q c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2841
      using that [unfolded singular_chain_def]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2842
    proof (induction c rule: frag_induction)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2843
      case (one m)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2844
      show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2845
      proof (simp add: pr_def, intro singular_chain_cmul singular_chain_sum)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2846
        fix i :: "nat"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2847
        assume "i \<in> {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2848
        define X where "X = subtopology (powertop_real UNIV) {x. x 0 \<in> {0..1} \<and> (x \<circ> Suc) \<in> standard_simplex q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2849
        show "singular_chain (Suc q) U
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2850
                 (frag_of (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2851
          unfolding singular_chain_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2852
        proof (rule singular_simplex_simplex_map)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2853
          show "singular_simplex (Suc q) X (simp q i)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2854
            unfolding X_def using \<open>i \<in> {..q}\<close> simplicial_imp_singular_simplex ss_ss by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2855
          have 0: "continuous_map X (top_of_set {0..1}) (\<lambda>x. x 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2856
            unfolding continuous_map_in_subtopology topspace_subtopology X_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2857
            by (auto intro: continuous_map_product_projection continuous_map_from_subtopology)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2858
          have 1: "continuous_map X S (m \<circ> (\<lambda>x j. x (Suc j)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2859
          proof (rule continuous_map_compose)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2860
            have "continuous_map (powertop_real UNIV) (powertop_real UNIV) (\<lambda>x j. x (Suc j))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2861
              by (auto intro: continuous_map_product_projection)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2862
            then show "continuous_map X (subtopology (powertop_real UNIV) (standard_simplex q)) (\<lambda>x j. x (Suc j))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2863
              unfolding X_def o_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2864
              by (auto simp: continuous_map_in_subtopology intro: continuous_map_from_subtopology continuous_map_product_projection)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2865
          qed (use one in \<open>simp add: singular_simplex_def\<close>)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2866
          show "continuous_map X U (\<lambda>z. h (z 0, m (z \<circ> Suc)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2867
            apply (rule continuous_map_compose [unfolded o_def, OF _ conth])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2868
            using 0 1 by (simp add: continuous_map_pairwise o_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2869
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2870
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2871
    next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2872
      case (diff a b)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2873
      then show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2874
        apply (simp add: frag_extend_diff keys_diff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2875
        using singular_chain_def singular_chain_diff by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2876
    qed auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2877
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2878
    show "singular_chain (Suc q) (subtopology U V) ((frag_extend \<circ> pr) q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2879
      if "singular_chain q (subtopology S T) c" for q c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2880
      using that [unfolded singular_chain_def]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2881
    proof (induction c rule: frag_induction)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2882
      case (one m)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2883
      show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2884
      proof (simp add: pr_def, intro singular_chain_cmul singular_chain_sum)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2885
        fix i :: "nat"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2886
        assume "i \<in> {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2887
        define X where "X = subtopology (powertop_real UNIV) {x. x 0 \<in> {0..1} \<and> (x \<circ> Suc) \<in> standard_simplex q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2888
        show "singular_chain (Suc q) (subtopology U V)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2889
                 (frag_of (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2890
          unfolding singular_chain_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2891
        proof (rule singular_simplex_simplex_map)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2892
          show "singular_simplex (Suc q) X (simp q i)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2893
            unfolding X_def using \<open>i \<in> {..q}\<close> simplicial_imp_singular_simplex ss_ss by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2894
          have 0: "continuous_map X (top_of_set {0..1}) (\<lambda>x. x 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2895
            unfolding continuous_map_in_subtopology topspace_subtopology X_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2896
            by (auto intro: continuous_map_product_projection continuous_map_from_subtopology)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2897
          have 1: "continuous_map X (subtopology S T) (m \<circ> (\<lambda>x j. x (Suc j)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2898
          proof (rule continuous_map_compose)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2899
            have "continuous_map (powertop_real UNIV) (powertop_real UNIV) (\<lambda>x j. x (Suc j))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2900
              by (auto intro: continuous_map_product_projection)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2901
            then show "continuous_map X (subtopology (powertop_real UNIV) (standard_simplex q)) (\<lambda>x j. x (Suc j))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2902
              unfolding X_def o_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2903
              by (auto simp: continuous_map_in_subtopology intro: continuous_map_from_subtopology continuous_map_product_projection)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2904
            show "continuous_map (subtopology (powertop_real UNIV) (standard_simplex q)) (subtopology S T) m"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2905
              using one continuous_map_into_fulltopology by (auto simp: singular_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2906
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2907
          have "continuous_map X (subtopology U V) (h \<circ> (\<lambda>z. (z 0, m (z \<circ> Suc))))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2908
          proof (rule continuous_map_compose)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2909
            show "continuous_map X (prod_topology (top_of_set {0..1::real}) (subtopology S T)) (\<lambda>z. (z 0, m (z \<circ> Suc)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2910
              using 0 1 by (simp add: continuous_map_pairwise o_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2911
            have "continuous_map (subtopology (prod_topology euclideanreal S) ({0..1} \<times> T)) U h"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2912
              by (metis conth continuous_map_from_subtopology subtopology_Times subtopology_topspace)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2913
            with hV show "continuous_map (prod_topology (top_of_set {0..1::real}) (subtopology S T)) (subtopology U V) h"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2914
              by (force simp: topspace_subtopology continuous_map_in_subtopology subtopology_restrict subtopology_Times)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2915
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2916
          then show "continuous_map X (subtopology U V) (\<lambda>z. h (z 0, m (z \<circ> Suc)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2917
            by (simp add: o_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2918
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2919
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2920
    next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2921
      case (diff a b)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2922
      then show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2923
        by (metis comp_apply frag_extend_diff singular_chain_diff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2924
    qed auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2925
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2926
    show "chain_boundary (Suc q) ((frag_extend \<circ> pr) q c) =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2927
        chain_map q g c - chain_map q f c - (frag_extend \<circ> pr) (q -1) (chain_boundary q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2928
      if "singular_chain q S c" for q c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2929
      using that [unfolded singular_chain_def]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2930
    proof (induction c rule: frag_induction)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2931
      case (one m)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2932
      have eq2: "Sigma S T = (\<lambda>i. (i,i)) ` {i \<in> S. i \<in> T i} \<union> (Sigma S (\<lambda>i. T i - {i}))" for S :: "nat set" and T
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2933
        by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2934
      have 1: "(\<Sum>(i,j)\<in>(\<lambda>i. (i, i)) ` {i. i \<le> q \<and> i \<le> Suc q}.
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2935
                   frag_cmul (((-1) ^ i) * (-1) ^ j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2936
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2937
                        (singular_face (Suc q) j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2938
                          (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2939
             + (\<Sum>(i,j)\<in>(\<lambda>i. (i, i)) ` {i. i \<le> q}.
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2940
                     frag_cmul (- ((-1) ^ i * (-1) ^ j))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2941
                        (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2942
                          (singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2943
                            (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2944
             = frag_of (simplex_map q g m) - frag_of (simplex_map q f m)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2945
      proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2946
        have "restrict ((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q 0 \<circ> simplical_face 0)) (standard_simplex q)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2947
          = restrict (g \<circ> m) (standard_simplex q)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2948
        proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2949
          fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2950
          assume x: "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2951
          have "(\<Sum>j\<le>Suc q. if j = 0 then 0 else x (j - Suc 0)) = (\<Sum>j\<le>q. x j)"
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 70097
diff changeset
  2952
            by (simp add: sum.atMost_Suc_shift)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2953
          with x have "simp q 0 (simplical_face 0 x) 0 = 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2954
            apply (simp add: oriented_simplex_def simp_def simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2955
            apply (simp add: simplical_face_def if_distrib ww_def standard_simplex_def cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2956
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2957
          moreover
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2958
          have "(\<lambda>n. if n \<le> q then x n else 0) = x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2959
            using standard_simplex_def x by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2960
          then have "(\<lambda>n. simp q 0 (simplical_face 0 x) (Suc n)) = x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2961
            unfolding oriented_simplex_def simp_def ww_def using x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2962
            apply (simp add: simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2963
            apply (simp add: simplical_face_def if_distrib)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2964
            apply (simp add: if_distribR if_distrib cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2965
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2966
          ultimately show "((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q 0 \<circ> simplical_face 0)) x = (g \<circ> m) x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2967
            by (simp add: o_def h1)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2968
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2969
        then have a: "frag_of (singular_face (Suc q) 0 (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q 0)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2970
             = frag_of (simplex_map q g m)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2971
          by (simp add: singular_face_simplex_map) (simp add: simplex_map_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2972
        have "restrict ((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q q \<circ> simplical_face (Suc q))) (standard_simplex q)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2973
          = restrict (f \<circ> m) (standard_simplex q)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2974
        proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2975
          fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2976
          assume x: "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2977
          then have "simp q q (simplical_face (Suc q) x) 0 = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2978
            unfolding oriented_simplex_def simp_def
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  2979
            by (simp add: simplical_face_in_standard_simplex sum.atMost_Suc) (simp add: simplical_face_def vv_def)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2980
          moreover have "(\<lambda>n. simp q q (simplical_face (Suc q) x) (Suc n)) = x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2981
            unfolding oriented_simplex_def simp_def vv_def using x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2982
            apply (simp add: simplical_face_in_standard_simplex)
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  2983
            apply (force simp: standard_simplex_def simplical_face_def if_distribR if_distrib [of "\<lambda>x. x * _"] sum.atMost_Suc cong: if_cong)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2984
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2985
          ultimately show "((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q q \<circ> simplical_face (Suc q))) x = (f \<circ> m) x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2986
            by (simp add: o_def h0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2987
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2988
        then have b: "frag_of (singular_face (Suc q) (Suc q)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2989
                     (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q q)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2990
          = frag_of (simplex_map q f m)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2991
          by (simp add: singular_face_simplex_map) (simp add: simplex_map_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2992
        have sfeq: "simplex_map q (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q (Suc i) \<circ> simplical_face (Suc i))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2993
                = simplex_map q (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i \<circ> simplical_face (Suc i))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2994
          if "i < q" for i
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2995
          unfolding simplex_map_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2996
        proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2997
          fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2998
          assume "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2999
          then have "(simp q (Suc i) \<circ> simplical_face (Suc i)) x = (simp q i \<circ> simplical_face (Suc i)) x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3000
            unfolding oriented_simplex_def simp_def simplical_face_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3001
            by (force intro: sum.cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3002
          then show "((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q (Suc i) \<circ> simplical_face (Suc i))) x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3003
                 = ((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q i \<circ> simplical_face (Suc i))) x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3004
            by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3005
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3006
        have eqq: "{i. i \<le> q \<and> i \<le> Suc q} = {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3007
          by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3008
        have qeq: "{..q} = insert 0 ((\<lambda>i. Suc i) ` {i. i < q})" "{i. i \<le> q} = insert q {i. i < q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3009
          using le_imp_less_Suc less_Suc_eq_0_disj by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3010
        show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3011
          using a b
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3012
          apply (simp add: sum.reindex inj_on_def eqq)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3013
          apply (simp add: qeq sum.insert_if sum.reindex sum_negf singular_face_simplex_map sfeq)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3014
          done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3015
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3016
      have 2: "(\<Sum>(i,j)\<in>(SIGMA i:{..q}. {0..min (Suc q) i} - {i}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3017
                     frag_cmul ((-1) ^ i * (-1) ^ j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3018
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3019
                        (singular_face (Suc q) j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3020
                          (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3021
             + (\<Sum>(i,j)\<in>(SIGMA i:{..q}. {i..q} - {i}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3022
                 frag_cmul (- ((-1) ^ i * (-1) ^ j))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3023
                  (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3024
                    (singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3025
                      (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3026
             = - frag_extend (pr (q - Suc 0)) (chain_boundary q (frag_of m))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3027
      proof (cases "q=0")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3028
        case True
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3029
        then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3030
          by (simp add: chain_boundary_def flip: sum.Sigma)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3031
      next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3032
        case False
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3033
        have eq: "{..q - Suc 0} \<times> {..q} = Sigma {..q - Suc 0} (\<lambda>i. {0..min q i}) \<union> Sigma {..q} (\<lambda>i. {i<..q})"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3034
          by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3035
        have I: "(\<Sum>(i,j)\<in>(SIGMA i:{..q}. {0..min (Suc q) i} - {i}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3036
                    frag_cmul ((-1) ^ (i + j))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3037
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3038
                        (singular_face (Suc q) j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3039
                          (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i)))))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3040
               = (\<Sum>(i,j)\<in>(SIGMA i:{..q - Suc 0}. {0..min q i}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3041
                   frag_cmul (- ((-1) ^ (j + i)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3042
                    (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3043
                      (simplex_map q (\<lambda>z. h (z 0, singular_face q j m (z \<circ> Suc)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3044
                        (simp (q - Suc 0) i))))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3045
        proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3046
          have seq: "simplex_map q (\<lambda>z. h (z 0, singular_face q j m (z \<circ> Suc)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3047
                       (simp (q - Suc 0) (i - Suc 0))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3048
                   = simplex_map q (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i \<circ> simplical_face j)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3049
            if ij: "i \<le> q" "j \<noteq> i" "j \<le> i" for i j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3050
            unfolding simplex_map_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3051
          proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3052
            fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3053
            assume x: "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3054
            have "i > 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3055
              using that by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3056
            then have iq: "i - Suc 0 \<le> q - Suc 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3057
              using \<open>i \<le> q\<close> False by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3058
            have q0_eq: "{..Suc q} = insert 0 (Suc ` {..q})"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3059
              by (auto simp: image_def gr0_conv_Suc)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3060
            have \<alpha>: "simp (q - Suc 0) (i - Suc 0) x 0 = simp q i (simplical_face j x) 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3061
              using False x ij
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3062
              unfolding oriented_simplex_def simp_def vv_def ww_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3063
              apply (simp add: simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3064
              apply (force simp: simplical_face_def q0_eq sum.reindex intro!: sum.cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3065
              done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3066
            have \<beta>: "simplical_face j (simp (q - Suc 0) (i - Suc 0) x \<circ> Suc) = simp q i (simplical_face j x) \<circ> Suc"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3067
            proof
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3068
              fix k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3069
              show "simplical_face j (simp (q - Suc 0) (i - Suc 0) x \<circ> Suc) k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3070
                  = (simp q i (simplical_face j x) \<circ> Suc) k"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3071
                using False x ij
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3072
                unfolding oriented_simplex_def simp_def o_def vv_def ww_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3073
                apply (simp add: simplical_face_in_standard_simplex if_distribR)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3074
                apply (simp add: simplical_face_def if_distrib [of "\<lambda>u. u * _"] cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3075
                apply (intro impI conjI)
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  3076
                 apply (force simp: sum.atMost_Suc intro: sum.cong)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3077
                apply (force simp: q0_eq sum.reindex intro!: sum.cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3078
                done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3079
            qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3080
            have "simp (q - Suc 0) (i - Suc 0) x \<circ> Suc \<in> standard_simplex (q - Suc 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3081
              using ss_ss [OF iq] \<open>i \<le> q\<close> False \<open>i > 0\<close>
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3082
              apply (simp add: simplicial_simplex image_subset_iff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3083
              using \<open>x \<in> standard_simplex q\<close> by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3084
            then show "((\<lambda>z. h (z 0, singular_face q j m (z \<circ> Suc))) \<circ> simp (q - Suc 0) (i - Suc 0)) x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3085
                = ((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> (simp q i \<circ> simplical_face j)) x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3086
              by (simp add: singular_face_def \<alpha> \<beta>)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3087
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3088
          have [simp]: "(-1::int) ^ (i + j - Suc 0) = - ((-1) ^ (i + j))" if "i \<noteq> j" for i j::nat
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3089
          proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3090
            have "i + j > 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3091
              using that by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3092
            then show ?thesis
73932
fd21b4a93043 added opaque_combs and renamed hide_lams to opaque_lifting
desharna
parents: 73655
diff changeset
  3093
              by (metis (no_types, opaque_lifting) One_nat_def Suc_diff_1 add.inverse_inverse mult.left_neutral mult_minus_left power_Suc)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3094
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3095
          show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3096
            apply (rule sum.eq_general_inverses [where h = "\<lambda>(a,b). (a-1,b)" and k = "\<lambda>(a,b). (Suc a,b)"])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3097
            using False apply (auto simp: singular_face_simplex_map seq add.commute)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3098
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3099
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3100
        have *: "singular_face (Suc q) (Suc j) (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3101
               = simplex_map q (\<lambda>z. h (z 0, singular_face q j m (z \<circ> Suc))) (simp (q - Suc 0) i)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3102
          if ij: "i < j" "j \<le> q" for i j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3103
        proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3104
          have iq: "i \<le> q - Suc 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3105
            using that by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3106
          have sf_eqh: "singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3107
                           (\<lambda>x. if x \<in> standard_simplex (Suc q)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3108
                                then ((\<lambda>z. h (z 0, m (z \<circ> Suc))) \<circ> simp q i) x else undefined) x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3109
                      = h (simp (q - Suc 0) i x 0,
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3110
                           singular_face q j m (\<lambda>xa. simp (q - Suc 0) i x (Suc xa)))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3111
            if x: "x \<in> standard_simplex q" for x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3112
          proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3113
            let ?f = "\<lambda>k. \<Sum>j\<le>q. if j \<le> i then if k = j then x j else 0
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3114
                               else if Suc k = j then x j else 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3115
            have fm: "simplical_face (Suc j) x \<in> standard_simplex (Suc q)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3116
              using ss_ss [OF iq] that ij
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3117
              by (simp add: simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3118
            have ss: "?f \<in> standard_simplex (q - Suc 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3119
              unfolding standard_simplex_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3120
            proof (intro CollectI conjI impI allI)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3121
              fix k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3122
              show "0 \<le> ?f k"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3123
                using that by (simp add: sum_nonneg standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3124
              show "?f k \<le> 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3125
                using x sum_le_included [of "{..q}" "{..q}" x "id"]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3126
                by (simp add: standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3127
              assume k: "q - Suc 0 < k"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3128
              show "?f k = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3129
                by (rule sum.neutral) (use that x iq k standard_simplex_def in auto)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3130
            next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3131
              have "(\<Sum>k\<le>q - Suc 0. ?f k)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3132
                  = (\<Sum>(k,j) \<in> ({..q - Suc 0} \<times> {..q}) \<inter> {(k,j). if j \<le> i then k = j else Suc k = j}. x j)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3133
                apply (simp add: sum.Sigma)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3134
                by (rule sum.mono_neutral_cong) (auto simp: split: if_split_asm)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3135
              also have "\<dots> = sum x {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3136
                apply (rule sum.eq_general_inverses
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3137
                    [where h = "\<lambda>(k,j). if j\<le>i \<and> k=j \<or> j>i \<and> Suc k = j then j else Suc q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3138
                      and k = "\<lambda>j. if j \<le> i then (j,j) else (j - Suc 0, j)"])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3139
                using ij by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3140
              also have "\<dots> = 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3141
                using x by (simp add: standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3142
              finally show "(\<Sum>k\<le>q - Suc 0. ?f k) = 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3143
                by (simp add: standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3144
            qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3145
            let ?g = "\<lambda>k. if k \<le> i then 0
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3146
                              else if k < Suc j then x k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3147
                                   else if k = Suc j then 0 else x (k - Suc 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3148
            have eq: "{..Suc q} = {..j} \<union> {Suc j} \<union> Suc`{j<..q}" "{..q} = {..j} \<union> {j<..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3149
              using ij image_iff less_Suc_eq_0_disj less_Suc_eq_le
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3150
              by (force simp: image_iff)+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3151
            then have "(\<Sum>k\<le>Suc q. ?g k) = (\<Sum>k\<in>{..j} \<union> {Suc j} \<union> Suc`{j<..q}. ?g k)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3152
              by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3153
            also have "\<dots> = (\<Sum>k\<in>{..j} \<union> Suc`{j<..q}. ?g k)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3154
              by (rule sum.mono_neutral_right) auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3155
            also have "\<dots> = (\<Sum>k\<in>{..j}. ?g k) + (\<Sum>k\<in>Suc`{j<..q}. ?g k)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3156
              by (rule sum.union_disjoint) auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3157
            also have "\<dots> = (\<Sum>k\<in>{..j}. ?g k) + (\<Sum>k\<in>{j<..q}. ?g (Suc k))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3158
              by (auto simp: sum.reindex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3159
            also have "\<dots> = (\<Sum>k\<in>{..j}. if k \<le> i then 0 else x k)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3160
                           + (\<Sum>k\<in>{j<..q}. if k \<le> i then 0 else x k)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3161
              by (intro sum.cong arg_cong2 [of concl: "(+)"]) (use ij in auto)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3162
            also have "\<dots> = (\<Sum>k\<le>q. if k \<le> i then 0 else x k)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3163
              unfolding eq by (subst sum.union_disjoint) auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3164
            finally have "(\<Sum>k\<le>Suc q. ?g k) = (\<Sum>k\<le>q. if k \<le> i then 0 else x k)" .
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3165
            then have QQ: "(\<Sum>l\<le>Suc q. if l \<le> i then 0 else simplical_face (Suc j) x l) = (\<Sum>j\<le>q. if j \<le> i then 0 else x j)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3166
              by (simp add: simplical_face_def cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3167
            have WW: "(\<lambda>k. \<Sum>l\<le>Suc q. if l \<le> i
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3168
                                    then if k = l then simplical_face (Suc j) x l else 0
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3169
                                    else if Suc k = l then simplical_face (Suc j) x l
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3170
                                    else 0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3171
                = simplical_face j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3172
                   (\<lambda>k. \<Sum>j\<le>q. if j \<le> i then if k = j then x j else 0
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3173
                                else if Suc k = j then x j else 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3174
            proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3175
              have *: "(\<Sum>l\<le>q. if l \<le> i then 0 else if Suc k = l then x (l - Suc 0) else 0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3176
                    = (\<Sum>l\<le>q. if l \<le> i then if k - Suc 0 = l then x l else 0 else if k = l then x l else 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3177
                (is "?lhs = ?rhs")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3178
                if "k \<noteq> q" "k > j" for k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3179
              proof (cases "k \<le> q")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3180
                case True
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3181
                have "?lhs = sum (\<lambda>l. x (l - Suc 0)) {Suc k}" "?rhs = sum x {k}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3182
                  by (rule sum.mono_neutral_cong_right; use True ij that in auto)+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3183
                then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3184
                  by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3185
              next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3186
                case False
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3187
                have "?lhs = 0" "?rhs = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3188
                  by (rule sum.neutral; use False ij in auto)+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3189
                then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3190
                  by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3191
              qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3192
              show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3193
                apply (rule ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3194
                unfolding simplical_face_def using ij
70097
4005298550a6 The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
paulson <lp15@cam.ac.uk>
parents: 70095
diff changeset
  3195
                apply (auto simp: sum.atMost_Suc cong: if_cong)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3196
                 apply (force simp flip: ivl_disj_un(2) intro: sum.neutral)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3197
                 apply (auto simp: *)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3198
                done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3199
            qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3200
            show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3201
              using False that iq
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3202
              unfolding oriented_simplex_def simp_def vv_def ww_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3203
              apply (simp add: if_distribR cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3204
              apply (simp add: simplical_face_def if_distrib [of "\<lambda>u. u * _"] o_def cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3205
              apply (simp add: singular_face_def fm ss QQ WW)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3206
              done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3207
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3208
          show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3209
            unfolding simplex_map_def restrict_def
72794
3757e64e75bb tweaked
paulson <lp15@cam.ac.uk>
parents: 71200
diff changeset
  3210
            apply (simp add: simplicial_simplex image_subset_iff o_def sf_eqh fun_eq_iff)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3211
            apply (simp add: singular_face_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3212
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3213
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3214
        have sgeq: "(SIGMA i:{..q}. {i..q} - {i})  = (SIGMA i:{..q}. {i<..q})"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3215
          by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3216
        have II: "(\<Sum>(i,j)\<in>(SIGMA i:{..q}. {i..q} - {i}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3217
                     frag_cmul (- ((-1) ^ (i + j)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3218
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3219
                        (singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3220
                          (simplex_map (Suc q) (\<lambda>z. h (z 0, m (z \<circ> Suc))) (simp q i))))) =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3221
                  (\<Sum>(i,j)\<in>(SIGMA i:{..q}. {i<..q}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3222
                     frag_cmul (- ((-1) ^ (j + i)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3223
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3224
                        (simplex_map q (\<lambda>z. h (z 0, singular_face q j m (z \<circ> Suc)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3225
                          (simp (q - Suc 0) i))))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3226
          by (force simp: * sgeq add.commute intro: sum.cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3227
        show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3228
          using False
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3229
          apply (simp add: chain_boundary_def frag_extend_sum frag_extend_cmul frag_cmul_sum pr_def flip: sum_negf power_add)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3230
          apply (subst sum.swap [where A = "{..q}"])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3231
          apply (simp add: sum.cartesian_product eq sum.union_disjoint disjoint_iff_not_equal I II)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3232
          done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3233
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3234
      have *: "\<lbrakk>a+b = w; c+d = -z\<rbrakk> \<Longrightarrow> (a + c) + (b+d) = w-z" for a b w c d z :: "'c \<Rightarrow>\<^sub>0 int"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3235
        by (auto simp: algebra_simps)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3236
      have eq: "{..q} \<times> {..Suc q} =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3237
                Sigma {..q} (\<lambda>i. {0..min (Suc q) i})
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3238
              \<union> Sigma {..q} (\<lambda>i. {Suc i..Suc q})"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3239
        by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3240
      show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3241
        apply (subst pr_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3242
        apply (simp add: chain_boundary_sum chain_boundary_cmul)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3243
        apply (subst chain_boundary_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3244
        apply (simp add: frag_cmul_sum sum.cartesian_product eq sum.union_disjoint disjoint_iff_not_equal
70113
c8deb8ba6d05 Fixing the main Homology theory; also moving a lot of sum/prod lemmas into their generic context
paulson <lp15@cam.ac.uk>
parents: 70097
diff changeset
  3245
                     sum.atLeast_Suc_atMost_Suc_shift del: sum.cl_ivl_Suc flip: comm_monoid_add_class.sum.Sigma)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3246
        apply (simp add: comm_monoid_add_class.sum.Sigma eq2 [of _ "\<lambda>i. {_ i.._ i}"])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3247
        apply (simp add: sum.union_disjoint disjoint_iff_not_equal * [OF 1 2])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3248
        done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3249
    next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3250
      case (diff a b)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3251
      then show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3252
        by (simp add: chain_boundary_diff frag_extend_diff chain_map_diff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3253
    qed auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3254
  qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3255
  have *: "singular_chain p (subtopology U V) (prism (p - Suc 0) (chain_boundary p c))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3256
    if "singular_chain p S c" "singular_chain (p - Suc 0) (subtopology S T) (chain_boundary p c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3257
  proof (cases "p")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3258
    case 0 then show ?thesis by (simp add: chain_boundary_def prism)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3259
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3260
    case (Suc p')
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3261
    with prism that show ?thesis by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3262
  qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3263
  then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3264
    using c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3265
    unfolding singular_relcycle_def homologous_rel_def singular_relboundary_def mod_subset_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3266
    apply (rule_tac x="- prism p c" in exI)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3267
    by (simp add: chain_boundary_minus prism(2) prism(4) singular_chain_minus)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3268
qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3269
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3270
end
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3271