src/HOL/Homology/Simplices.thy
author wenzelm
Sat, 01 Jun 2019 11:29:59 +0200
changeset 70299 83774d669b51
parent 70178 4900351361b0
child 70817 dd675800469d
permissions -rw-r--r--
Added tag Isabelle2019-RC4 for changeset ad2d84c42380
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"
70089
eca8611201e9 new Homology target, depending on HOL-Algebra and HOL-Analysis
paulson <lp15@cam.ac.uk>
parents: 70086
diff changeset
     4
  imports "HOL-Analysis.Abstract_Euclidean_Space" "HOL-Algebra.Free_Abelian_Groups"
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     5
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     6
begin
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
     7
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
     8
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
     9
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    10
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
    11
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    12
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
    13
  "standard_simplex p \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    14
    {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
    15
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    16
lemma topspace_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    17
  "topspace(subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    18
    = standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    19
  by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    20
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    21
lemma basis_in_standard_simplex [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    22
   "(\<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
    23
  by (auto simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    24
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    25
lemma nonempty_standard_simplex: "standard_simplex p \<noteq> {}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    26
  using basis_in_standard_simplex by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    27
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    28
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
    29
  by (auto simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    30
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    31
lemma standard_simplex_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    32
  assumes "p \<le> q"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    33
  shows "standard_simplex p \<subseteq> standard_simplex q"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    34
  using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    35
proof (clarsimp simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    36
  fix x :: "nat \<Rightarrow> real"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    37
  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
    38
  then show "sum x {..q} = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    39
    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
    40
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    41
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    42
lemma closedin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    43
   "closedin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    44
    (is "closedin ?X ?S")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    45
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    46
  have eq: "standard_simplex p =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    47
              (\<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
    48
              (\<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
    49
              {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
    50
    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
    51
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    52
    unfolding eq
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    53
    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
    54
             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
    55
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    56
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    57
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
    58
  using standard_simplex_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    59
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    60
lemma compactin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    61
   "compactin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    62
  apply (rule closed_compactin [where K = "PiE UNIV (\<lambda>i. {0..1})"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    63
    apply (simp_all add: compactin_PiE standard_simplex_01 closedin_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    64
  done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    65
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    66
lemma convex_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    67
   "\<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
    68
     0 \<le> u; u \<le> 1\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    69
    \<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
    70
  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
    71
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    72
lemma path_connectedin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    73
   "path_connectedin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    74
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    75
  define g where "g \<equiv> \<lambda>x y::nat\<Rightarrow>real. \<lambda>u i. (1 - u) * x i + u * y i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    76
  have 1: "continuous_map
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    77
                (subtopology euclideanreal {0..1}) (powertop_real UNIV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    78
                (g x y)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    79
    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
    80
    unfolding g_def continuous_map_componentwise
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    81
    by (force intro: continuous_intros)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    82
  have 2: "g x y ` {0..1} \<subseteq> standard_simplex p" "g x y 0 = x" "g x y 1 = y"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    83
    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
    84
    using that by (auto simp: convex_standard_simplex g_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    85
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    86
    unfolding path_connectedin_def path_connected_space_def pathin_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    87
    apply (simp add: topspace_standard_simplex topspace_product_topology continuous_map_in_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    88
    by (metis 1 2)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    89
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    90
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    91
lemma connectedin_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    92
   "connectedin (powertop_real UNIV) (standard_simplex p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    93
  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
    94
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    95
subsection\<open>Face map\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    96
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
    97
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
    98
   "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
    99
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   100
lemma simplical_face_in_standard_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   101
  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
   102
  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
   103
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   104
  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
   105
    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
   106
  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
   107
    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
   108
    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
   109
  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
   110
         = (\<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
   111
    by (simp add: gg)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   112
  consider "k \<le> p - Suc 0" | "k = p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   113
    using \<open>k \<le> p\<close> by linarith
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   114
  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
   115
  proof cases
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   116
    case 1
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   117
    have [simp]: "Suc (p - Suc 0) = p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   118
      using \<open>1 \<le> p\<close> by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   119
    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
   120
      by (rule sum.mono_neutral_right) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   121
    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
   122
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   123
    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
   124
      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
   125
    finally have eq2: "(\<Sum>i = k..p. if i = k then 0 else x (i -1)) = (\<Sum>i = k..p-1. x i)" .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   126
    with 1 show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   127
      apply (simp add: eq eq2)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   128
      by (metis (mono_tags, lifting) One_nat_def assms(3) finite_atLeastAtMost finite_lessThan ivl_disj_int(4) ivl_disj_un(10) mem_Collect_eq standard_simplex_def sum.union_disjoint)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   129
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   130
    case 2
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   131
    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
   132
      using assms by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   133
    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
   134
      by (rule sum.cong) (auto simp: 2)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   135
    also have "\<dots> = sum x {..p-1}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   136
      by (simp add: sum.If_cases)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   137
    also have "\<dots> = 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   138
      by (simp add: sumx)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   139
    finally show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   140
      using 2 by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   141
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   142
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   143
    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
   144
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   145
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   146
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
   147
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   148
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
   149
 "singular_simplex p X f \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   150
      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
   151
    \<and> f \<in> extensional (standard_simplex p)"
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
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
   154
 "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
   155
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   156
lemma singular_simplex_empty:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   157
   "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
   158
  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
   159
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   160
lemma singular_simplex_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   161
   "\<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
   162
  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
   163
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   164
lemma singular_simplex_subtopology:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   165
   "singular_simplex p (subtopology X S) f \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   166
        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
   167
  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
   168
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   169
subsubsection\<open>Singular face\<close>
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
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
   172
  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
   173
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   174
lemma singular_simplex_singular_face:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   175
  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
   176
  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
   177
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   178
  let ?PT = "(powertop_real UNIV)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   179
  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
   180
    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
   181
  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
   182
                          (subtopology ?PT (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   183
                          (simplical_face k)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   184
  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
   185
    fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   186
    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
   187
      by (auto intro: continuous_map_product_projection)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   188
    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
   189
                              (\<lambda>x. simplical_face k x i)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   190
      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
   191
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   192
  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
   193
    using assms(1) singular_simplex_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   194
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   195
    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
   196
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   197
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   198
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   199
subsection\<open>Singular chains\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   200
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   201
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
   202
  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
   203
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   204
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
   205
  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
   206
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   207
lemma singular_chain_empty:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   208
   "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
   209
  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
   210
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   211
lemma singular_chain_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   212
   "\<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
   213
        \<Longrightarrow> singular_chain p (subtopology X S) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   214
  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
   215
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   216
lemma singular_chain_subtopology:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   217
   "singular_chain p (subtopology X S) c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   218
        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
   219
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   220
  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
   221
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   222
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
   223
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   224
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   225
lemma singular_chain_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   226
   "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
   227
  by (auto simp: singular_chain_def)
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_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   230
   "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
   231
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   232
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   233
lemma singular_chain_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   234
   "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
   235
  by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   236
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   237
lemma singular_chain_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   238
   "\<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
   239
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   240
  using keys_add [of a b] by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   241
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   242
lemma singular_chain_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   243
   "\<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
   244
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   245
  using keys_diff [of a b] by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   246
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   247
lemma singular_chain_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   248
   "(\<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
   249
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   250
  using keys_sum [of f I] by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   251
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   252
lemma singular_chain_extend:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   253
   "(\<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
   254
        \<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
   255
  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
   256
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   257
subsection\<open>Boundary homomorphism for singular chains\<close>
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
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
   260
  where "chain_boundary p c \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   261
          (if p = 0 then 0 else
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   262
           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
   263
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   264
lemma singular_chain_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   265
  "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   266
        \<Longrightarrow> singular_chain (p - Suc 0) X (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   267
  unfolding chain_boundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   268
  apply (clarsimp intro!: singular_chain_extend singular_chain_sum singular_chain_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   269
  apply (auto simp: singular_chain_def intro: singular_simplex_singular_face)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   270
  done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   271
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   272
lemma singular_chain_boundary_alt:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   273
   "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
   274
  using singular_chain_boundary by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   275
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   276
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
   277
  by (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   278
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   279
lemma chain_boundary_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   280
   "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
   281
  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
   282
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   283
lemma chain_boundary_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   284
   "chain_boundary p (- c) = - (chain_boundary p c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   285
  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
   286
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   287
lemma chain_boundary_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   288
   "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
   289
  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
   290
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   291
lemma chain_boundary_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   292
   "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
   293
  using chain_boundary_add [of p a "-b"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   294
  by (simp add: chain_boundary_minus)
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_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   297
   "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
   298
  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
   299
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   300
lemma chain_boundary_sum':
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   301
   "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
   302
  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
   303
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   304
lemma chain_boundary_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   305
   "chain_boundary p (frag_of f) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   306
        (if p = 0 then 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   307
         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
   308
  by (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   309
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   310
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
   311
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   312
definition mod_subset
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   313
  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
   314
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   315
lemma mod_subset_empty [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   316
   "(a,b) \<in> (mod_subset p (subtopology X {})) \<longleftrightarrow> a = b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   317
  by (simp add: mod_subset_def singular_chain_empty topspace_subtopology)
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
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
   320
  by (auto simp: mod_subset_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   321
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   322
lemma mod_subset_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   323
  "(a,b) \<in> (mod_subset p X) \<Longrightarrow> (frag_cmul k a, frag_cmul k b) \<in> (mod_subset p X)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   324
  apply (simp add: mod_subset_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   325
  by (metis add_diff_cancel diff_add_cancel frag_cmul_distrib2 singular_chain_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   326
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   327
lemma mod_subset_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   328
   "\<lbrakk>(c1,c2) \<in> (mod_subset p X); (d1,d2) \<in> (mod_subset p X)\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   329
    \<Longrightarrow> (c1+d1, c2+d2) \<in> (mod_subset p X)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   330
  apply (simp add: mod_subset_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   331
  by (simp add: add_diff_add singular_chain_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   332
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   333
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
   334
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   335
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
   336
  where "singular_relcycle p X S \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   337
        \<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
   338
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   339
abbreviation singular_relcycle_set
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   340
  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
   341
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   342
lemma singular_relcycle_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   343
   "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
   344
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   345
  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
   346
    by (metis subtopology_subtopology subtopology_topspace)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   347
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   348
    by (force simp: singular_relcycle_def eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   349
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   350
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   351
lemma singular_relcycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   352
   "singular_relcycle p X S c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   353
    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
   354
  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
   355
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   356
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
   357
  by (auto simp: singular_relcycle_def)
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_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   360
   "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
   361
  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
   362
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   363
lemma singular_relcycle_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   364
   "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
   365
  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
   366
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   367
lemma singular_relcycle_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   368
   "\<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
   369
        \<Longrightarrow> singular_relcycle p X S (a+b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   370
  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
   371
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   372
lemma singular_relcycle_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   373
   "\<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
   374
        \<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
   375
  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
   376
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   377
lemma singular_relcycle_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   378
   "\<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
   379
        \<Longrightarrow> singular_relcycle p X S (a-b)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   380
  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
   381
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   382
lemma singular_cycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   383
   "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
   384
  by (simp add: singular_relcycle_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   385
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   386
lemma singular_cycle_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   387
   "\<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
   388
        \<Longrightarrow> singular_relcycle p (subtopology X S) {} c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   389
  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
   390
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   391
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   392
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
   393
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   394
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
   395
  where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   396
  "singular_relboundary p X S \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   397
    \<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
   398
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   399
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
   400
  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
   401
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   402
lemma singular_relboundary_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   403
   "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
   404
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   405
  by (metis (no_types, hide_lams) subtopology_subtopology subtopology_topspace)
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
lemma singular_relboundary_alt:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   408
   "singular_relboundary p X S c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   409
    (\<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
   410
           chain_boundary (Suc p) d = c + e)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   411
  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
   412
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   413
lemma singular_relboundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   414
   "singular_relboundary p X S c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   415
    (\<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
   416
              (chain_boundary (Suc p) d) + e = c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   417
  using singular_chain_minus
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   418
  by (fastforce simp add: singular_relboundary_alt)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   419
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   420
lemma singular_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   421
   "singular_relboundary p X {} c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   422
    (\<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
   423
  by (simp add: singular_relboundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   424
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   425
lemma singular_boundary_imp_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   426
   "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
   427
  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
   428
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   429
lemma singular_boundary_mono:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   430
   "\<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
   431
        \<Longrightarrow> singular_relboundary p (subtopology X S) {} c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   432
  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
   433
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   434
lemma singular_relboundary_imp_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   435
   "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
   436
  unfolding singular_relboundary singular_chain_subtopology
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   437
  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
   438
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   439
lemma singular_chain_imp_relboundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   440
   "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
   441
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   442
  apply (rule_tac x=0 in exI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   443
  using mod_subset_def singular_chain_diff by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   444
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   445
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
   446
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   447
  by (rule_tac x=0 in exI) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   448
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   449
lemma singular_relboundary_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   450
   "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
   451
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   452
  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
   453
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   454
lemma singular_relboundary_minus:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   455
   "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
   456
  using singular_relboundary_cmul
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   457
  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
   458
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   459
lemma singular_relboundary_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   460
   "\<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
   461
  unfolding singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   462
  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
   463
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   464
lemma singular_relboundary_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   465
   "\<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
   466
  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
   467
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   468
subsection\<open>The (relative) homology relation\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   469
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   470
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
   471
  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
   472
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   473
abbreviation homologous_rel_set
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   474
  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
   475
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   476
lemma homologous_rel_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   477
   "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
   478
  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
   479
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   480
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
   481
  unfolding homologous_rel_def by auto
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_sym:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   484
   "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
   485
  unfolding homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   486
  using singular_relboundary_minus by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   487
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   488
lemma homologous_rel_trans:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   489
  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
   490
  shows "homologous_rel p X S a c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   491
  using homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   492
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   493
  have "singular_relboundary p X S (b - c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   494
    using assms unfolding homologous_rel_def by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   495
  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
   496
    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
   497
  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
   498
    using singular_relboundary_diff by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   499
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   500
    by (meson homologous_rel_def homologous_rel_sym)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   501
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   502
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   503
lemma homologous_rel_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   504
   "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
   505
    homologous_rel p X S a b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   506
  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
   507
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   508
lemma homologous_rel_set_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   509
   "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
   510
    homologous_rel p X S a b"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   511
  by (metis homologous_rel_eq mem_Collect_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   512
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   513
lemma homologous_rel_singular_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   514
  "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
   515
  unfolding homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   516
  using singular_chain_diff singular_chain_add
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   517
  by (fastforce dest: singular_relboundary_imp_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   518
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   519
lemma homologous_rel_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   520
   "\<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
   521
        \<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
   522
  unfolding homologous_rel_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   523
  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
   524
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   525
lemma homologous_rel_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   526
  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
   527
  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
   528
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   529
  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
   530
    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
   531
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   532
    by (simp add: homologous_rel_def algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   533
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   534
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   535
lemma homologous_rel_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   536
  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
   537
    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
   538
  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
   539
proof (cases "finite I")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   540
  case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   541
  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
   542
  have L: "finite ?L" "?L \<subseteq> I"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   543
    using f g by blast+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   544
  have "sum f I = sum f ?L"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   545
    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
   546
  moreover have "sum g I = sum g ?L"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   547
    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
   548
  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
   549
    using h that by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   550
  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
   551
    using L
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   552
  proof induction
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   553
    case (insert j J)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   554
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   555
      by (simp add: h homologous_rel_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   556
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   557
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   558
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   559
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   560
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   561
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   562
lemma chain_homotopic_imp_homologous_rel:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   563
  assumes
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   564
   "\<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
   565
   "\<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
   566
   "\<And>c. singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   567
             \<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
   568
    "singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   569
  shows "homologous_rel p X' T (f c) (g c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   570
  using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   571
  unfolding singular_relcycle_def mod_subset_def homologous_rel_def singular_relboundary_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   572
  apply (rule_tac x="h c" in exI, simp)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   573
  by (metis (no_types, lifting) add_diff_cancel_left' minus_diff_eq singular_chain_minus)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   574
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   575
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   576
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
   577
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   578
lemma chain_boundary_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   579
  assumes "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   580
  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
   581
proof (cases "p -1 = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   582
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   583
  then have "2 \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   584
    by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   585
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   586
    using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   587
    unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   588
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   589
    case (one g)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   590
    then have ss: "singular_simplex p X g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   591
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   592
    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
   593
      using False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   594
      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
   595
    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
   596
      by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   597
    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
   598
               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
   599
    proof (rule ext)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   600
      fix t
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   601
      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
   602
            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
   603
      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
   604
        case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   605
        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
   606
          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
   607
        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
   608
          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
   609
        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
   610
          using True that ss
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   611
          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
   612
        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
   613
      qed (simp add: singular_face_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   614
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   615
    show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   616
    proof (cases "p = 1")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   617
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   618
      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
   619
        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
   620
      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
   621
                 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
   622
              = 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
   623
        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
   624
        apply (rule eq0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   625
        apply (simp only: frag_cmul_sum prod.case_distrib [of "frag_cmul (-1)"] frag_cmul_cmul eql eqr flip: power_Suc)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   626
        apply (force simp: simp add: inj_on_def sum.reindex add.commute eqf intro: sum.cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   627
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   628
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   629
        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
   630
    qed (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   631
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   632
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   633
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   634
      by (simp add: chain_boundary_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   635
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   636
qed (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   637
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   638
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   639
lemma chain_boundary_boundary_alt:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   640
   "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
   641
  using chain_boundary_boundary by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   642
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   643
lemma singular_relboundary_imp_relcycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   644
  assumes "singular_relboundary p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   645
  shows "singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   646
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   647
  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
   648
               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
   649
               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
   650
    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
   651
  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
   652
    using d chain_boundary_boundary_alt by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   653
  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
   654
    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
   655
  have "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   656
    using assms singular_relboundary_imp_chain by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   657
  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
   658
    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
   659
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   660
    by (simp add: singular_relcycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   661
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   662
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   663
lemma homologous_rel_singular_relcycle_1:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   664
  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
   665
  shows "singular_relcycle p X S c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   666
  using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   667
  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
   668
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   669
lemma homologous_rel_singular_relcycle:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   670
  assumes "homologous_rel p X S c1 c2"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   671
  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
   672
  using assms homologous_rel_singular_relcycle_1
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   673
  using homologous_rel_sym by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   674
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   675
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   676
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
   677
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   678
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
   679
  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
   680
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   681
lemma singular_simplex_simplex_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   682
   "\<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
   683
        \<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
   684
  unfolding singular_simplex_def simplex_map_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   685
  by (auto simp: continuous_map_compose)
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
lemma simplex_map_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   688
   "\<lbrakk>singular_simplex p X c;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   689
     \<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
   690
    \<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
   691
  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
   692
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   693
lemma simplex_map_id_gen:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   694
   "\<lbrakk>singular_simplex p X c;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   695
     \<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
   696
    \<Longrightarrow> simplex_map p f c = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   697
  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
   698
  using extensional_arb by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   699
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   700
lemma simplex_map_id [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   701
   "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
   702
  by (auto simp: simplex_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_compose:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   705
   "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
   706
  unfolding simplex_map_def by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   707
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   708
lemma singular_face_simplex_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   709
   "\<lbrakk>1 \<le> p; k \<le> p\<rbrakk>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   710
        \<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
   711
  unfolding simplex_map_def singular_face_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   712
  by (force simp: simplical_face_in_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   713
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   714
lemma singular_face_restrict [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   715
  assumes "p > 0" "i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   716
  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
   717
  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
   718
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   719
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   720
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
   721
  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
   722
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   723
lemma singular_chain_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   724
   "\<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
   725
  unfolding chain_map_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   726
  apply (rule singular_chain_extend)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   727
  by (metis comp_apply subsetD mem_Collect_eq singular_chain_def singular_chain_of singular_simplex_simplex_map)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   728
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   729
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
   730
  by (auto simp: chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   731
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   732
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
   733
  by (simp add: chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   734
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   735
lemma chain_map_cmul [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   736
   "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
   737
  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
   738
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   739
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
   740
  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
   741
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   742
lemma chain_map_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   743
   "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
   744
  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
   745
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   746
lemma chain_map_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   747
   "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
   748
  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
   749
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   750
lemma chain_map_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   751
   "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
   752
  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
   753
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   754
lemma chain_map_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   755
   "\<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
   756
    \<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
   757
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   758
  apply (erule frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   759
    apply (auto simp: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   760
  apply (metis simplex_map_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   761
  done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   762
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   763
lemma chain_map_id_gen:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   764
   "\<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
   765
    \<Longrightarrow>  chain_map p f c = c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   766
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   767
  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
   768
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   769
lemma chain_map_ident:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   770
   "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
   771
  by (simp add: chain_map_id_gen)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   772
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   773
lemma chain_map_id:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   774
   "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
   775
  by (auto simp: chain_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   776
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   777
lemma chain_map_compose:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   778
   "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
   779
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   780
  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
   781
    using subset_UNIV
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   782
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   783
    case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   784
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   785
      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
   786
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   787
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   788
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   789
      by (simp add: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   790
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   791
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   792
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   793
lemma singular_simplex_chain_map_id:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   794
  assumes "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   795
  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
   796
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   797
  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
   798
    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
   799
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   800
    by (simp add: simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   801
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   802
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   803
lemma chain_boundary_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   804
  assumes "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   805
  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
   806
  using assms unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   807
proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   808
  case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   809
  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
   810
    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
   811
    using that
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   812
    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
   813
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   814
    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
   815
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   816
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   817
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   818
    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
   819
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   820
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   821
lemma singular_relcycle_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   822
  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
   823
  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
   824
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   825
  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
   826
    using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   827
    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
   828
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   829
    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
   830
    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
   831
qed
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_relboundary_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   834
  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
   835
  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
   836
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   837
  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
   838
    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
   839
    using assms by (auto simp: singular_relboundary)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   840
  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
   841
    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
   842
  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
   843
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   844
    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
   845
      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
   846
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   847
      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
   848
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   849
  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
   850
                 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
   851
    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
   852
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   853
    unfolding singular_relboundary
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   854
    using c by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   855
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   856
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   857
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   858
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
   859
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   860
lemma singular_simplex_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   861
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   862
  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
   863
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   864
  assume L: ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   865
  then show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   866
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   867
    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
   868
      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
   869
    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
   870
      by (simp add: assms continuous_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   871
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   872
      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
   873
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   874
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   875
  assume ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   876
  with assms show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   877
    by (auto simp: singular_simplex_def topspace_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   878
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   879
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   880
lemma singular_chain_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   881
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   882
  shows "singular_chain p X c \<longleftrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   883
         (\<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
   884
    (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   885
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   886
  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
   887
  assume L: ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   888
  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
   889
    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
   890
  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
   891
    by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   892
  then show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   893
  proof cases
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   894
    case 1
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   895
    with L show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   896
      by (metis frag_cmul_zero keys_eq_empty)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   897
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   898
    case 2
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   899
    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
   900
      by (force simp: frag_extend_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   901
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   902
      by (metis frag_expansion)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   903
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   904
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   905
  assume ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   906
  with assms show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   907
    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
   908
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   909
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   910
lemma chain_boundary_of_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   911
  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
   912
  shows "chain_boundary p c =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   913
         (if p = 0 \<or> odd p then 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   914
          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
   915
    (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   916
proof (cases "p = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   917
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   918
  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
   919
  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
   920
    fix f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   921
    assume "f \<in> Poly_Mapping.keys c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   922
    with assms have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   923
      by (auto simp: singular_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   924
    then have *: "\<And>k. k \<le> p \<Longrightarrow> singular_face p k f = (\<lambda>x\<in>standard_simplex (p -1). a)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   925
      apply (subst singular_simplex_singleton [OF tX, symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   926
      using False singular_simplex_singular_face by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   927
    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
   928
    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
   929
        = (\<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
   930
      by (auto simp: c_def * intro: sum.cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   931
    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
   932
      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
   933
    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
   934
                = (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
   935
      unfolding c_def .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   936
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   937
  also have "\<dots> = ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   938
    by (auto simp: False frag_extend_eq_0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   939
  finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   940
qed (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   941
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   942
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   943
lemma singular_cycle_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   944
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   945
  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
   946
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   947
  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
   948
    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
   949
    by (auto simp: frag_extend_cmul)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   950
  moreover
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   951
  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
   952
    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
   953
  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
   954
    by (simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   955
  ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   956
  using assms by (auto simp: singular_cycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   957
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   958
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   959
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   960
lemma singular_boundary_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   961
  assumes "topspace X = {a}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   962
  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
   963
proof (cases "singular_chain p X c")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   964
  case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   965
  have eq: "frag_extend (\<lambda>f. frag_of (\<lambda>x\<in>standard_simplex p. a)) (frag_of (\<lambda>x\<in>standard_simplex (Suc p). a))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   966
          = 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
   967
    by (simp add: singular_chain_singleton frag_extend_cmul assms)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   968
  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
   969
    if "singular_chain p X c" and "odd p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   970
    using assms that
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   971
    apply (clarsimp simp: singular_chain_singleton)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   972
    apply (rule_tac x = "frag_cmul b (frag_of (\<lambda>x\<in>standard_simplex (Suc p). a))" in exI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   973
    apply (subst chain_boundary_of_singleton [of X a "Suc p"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   974
    apply (auto simp: singular_chain_singleton frag_extend_cmul eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   975
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   976
  with True assms show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   977
    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
   978
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   979
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   980
  with assms singular_boundary_imp_chain show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   981
    by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   982
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   983
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   984
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   985
lemma singular_boundary_eq_cycle_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   986
  assumes "topspace X = {a}" "1 \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   987
  shows "singular_relboundary p X {} c \<longleftrightarrow> singular_relcycle p X {} c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   988
  using assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   989
  apply (auto simp: singular_boundary chain_boundary_boundary_alt singular_chain_boundary_alt singular_cycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   990
  by (metis Suc_neq_Zero le_zero_eq singular_boundary singular_boundary_singleton singular_chain_0 singular_cycle_singleton singular_relcycle)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   991
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   992
lemma singular_boundary_set_eq_cycle_singleton:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   993
  assumes "topspace X = {a}" "1 \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   994
  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
   995
  using singular_boundary_eq_cycle_singleton [OF assms]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   996
  by blast
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
subsection\<open>Simplicial chains\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
   999
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1000
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
  1001
 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
  1002
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
  1003
for 1 simplicial homology.\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1004
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1005
definition oriented_simplex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1006
  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
  1007
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1008
definition simplicial_simplex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1009
  where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1010
 "simplicial_simplex p S f \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1011
        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
  1012
        (\<exists>l. f = oriented_simplex p l)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1013
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1014
lemma simplicial_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1015
  "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
  1016
  (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1017
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1018
  assume R: ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1019
  show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1020
    using R
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1021
    apply (clarsimp simp: simplicial_simplex_def singular_simplex_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1022
    apply (simp add: singular_simplex_def oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1023
    apply (clarsimp simp: continuous_map_componentwise)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1024
    apply (intro continuous_intros continuous_map_from_subtopology continuous_map_product_projection, auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1025
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1026
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
  1027
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1028
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
  1029
  by (simp add: nonempty_standard_simplex simplicial_simplex)
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
definition simplicial_chain
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1032
  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
  1033
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1034
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
  1035
  by (simp add: simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1036
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1037
lemma simplicial_chain_of [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1038
   "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
  1039
  by (simp add: simplicial_chain_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1040
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1041
lemma simplicial_chain_cmul:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1042
   "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
  1043
  by (auto simp: simplicial_chain_def)
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_chain_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1046
   "\<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
  1047
  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
  1048
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1049
lemma simplicial_chain_sum:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1050
   "(\<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
  1051
  unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1052
  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
  1053
  by (simp add: UN_least)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1054
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1055
lemma simplicial_simplex_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1056
   "simplicial_simplex p S (oriented_simplex p l)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1057
    \<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
  1058
  by (auto simp: simplicial_simplex oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1059
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1060
lemma simplicial_imp_singular_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1061
   "simplicial_simplex p S f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1062
      \<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
  1063
  by (simp add: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1064
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1065
lemma simplicial_imp_singular_chain:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1066
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1067
      \<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
  1068
  unfolding simplicial_chain_def singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1069
  by (auto intro: simplicial_imp_singular_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1070
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1071
lemma oriented_simplex_eq:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1072
  "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
  1073
  (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1074
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1075
  assume L: ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1076
  show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1077
  proof clarify
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1078
    fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1079
    assume "i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1080
    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
  1081
    have "(\<Sum>j\<le>p. l j k * ?fi j) = (\<Sum>j\<le>p. l' j k * ?fi j)" for k
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1082
      apply (rule fun_cong [where x=k])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1083
      using fun_cong [OF L, of ?fi]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1084
      apply (simp add: \<open>i \<le> p\<close> oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1085
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1086
    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
  1087
      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
  1088
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1089
qed (auto simp: oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1090
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1091
lemma singular_face_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1092
  assumes "1 \<le> p" "k \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1093
  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
  1094
         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
  1095
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1096
  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
  1097
      = (\<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
  1098
    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
  1099
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1100
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1101
      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
  1102
      using sum.zero_middle [OF assms, where 'a=real, symmetric]
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1103
      apply (simp add: if_distrib [of "\<lambda>x. _ * x"] if_distrib [of "\<lambda>f. f i * _"] atLeast0AtMost cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1104
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1105
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1106
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1107
    using simplical_face_in_standard_simplex assms
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1108
    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
  1109
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1110
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1111
lemma simplicial_simplex_singular_face:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1112
  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
  1113
  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
  1114
  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
  1115
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1116
  let ?X = "subtopology (powertop_real UNIV) S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1117
  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
  1118
       and feq: "f = oriented_simplex p m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1119
    using assms by (force simp: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1120
  moreover have "\<exists>l. singular_face p k f = oriented_simplex (p - Suc 0) l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1121
    apply (simp add: feq singular_face_def oriented_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1122
    apply (simp add: simplical_face_in_standard_simplex [OF p] restrict_compose_left subset_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1123
    apply (rule_tac x="\<lambda>i. if i < k then m i else m (Suc i)" in exI)
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
  1124
    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
  1125
    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
  1126
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1127
  ultimately
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1128
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1129
    using assms by (simp add: singular_simplex_singular_face simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1130
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1131
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1132
lemma simplicial_chain_boundary:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1133
   "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
  1134
  unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1135
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1136
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1137
  then have "simplicial_simplex p S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1138
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1139
  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
  1140
    if "0 < p" "i \<le> p" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1141
    using that one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1142
    apply (simp add: simplicial_simplex_def singular_simplex_singular_face)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1143
    apply (force simp: singular_face_oriented_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1144
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1145
  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
  1146
    unfolding chain_boundary_def frag_extend_of
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1147
    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
  1148
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1149
    by (simp add: simplicial_chain_def [symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1150
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1151
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1152
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1153
    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
  1154
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1155
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1156
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1157
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
  1158
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1159
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
  1160
specification (simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1161
  simplex_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1162
    "\<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
  1163
          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
  1164
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1165
  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
  1166
                  = (y v \<circ> (oriented_simplex x))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1167
    apply (subst choice_iff [symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1168
    apply (subst function_factors_left [symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1169
    by (simp add: oriented_simplex_eq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1170
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1171
    apply (subst choice_iff [symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1172
    apply (subst fun_eq_iff [symmetric])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1173
    unfolding o_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1174
    apply (blast intro: sym)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1175
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1176
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1177
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1178
lemma simplicial_simplex_simplex_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1179
  assumes f: "simplicial_simplex p S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1180
    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
  1181
  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
  1182
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1183
  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
  1184
    and feq: "f = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1185
    using f by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1186
  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
  1187
    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
  1188
  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
  1189
                 \<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
  1190
    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
  1191
  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
  1192
    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
  1193
  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
  1194
    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
  1195
      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
  1196
    obtain a where "a \<in> S"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1197
      using f by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1198
    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
  1199
    proof (cases "x 0 = 1")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1200
      case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1201
      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
  1202
        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
  1203
      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
  1204
        unfolding sum.atLeast_Suc_atMost_Suc_shift
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1205
        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
  1206
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1207
        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
  1208
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1209
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1210
      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
  1211
        by (force simp: field_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1212
      also have "\<dots> \<in> T"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1213
      proof (rule T)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1214
        have "x 0 < 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1215
          by (simp add: False less_le x01)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1216
        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
  1217
        proof (cases "i \<le> p")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1218
          case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1219
          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
  1220
            by (rule sum_mono2) (auto simp: True x01)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1221
          then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1222
           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
  1223
        qed (simp add: x0 x01)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1224
        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
  1225
        proof (rule S)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1226
          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
  1227
            by (metis sum.atMost_Suc_shift)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1228
          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
  1229
            by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1230
          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
  1231
            by (metis add_diff_cancel_left' diff_diff_eq2 diff_zero right_inverse sum_distrib_right)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1232
      qed (use x01 x0 xle \<open>x 0 < 1\<close> in \<open>auto simp: divide_simps\<close>)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1233
      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
  1234
        by (simp add: field_simps sum_divide_distrib)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1235
    qed (use x01 in auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1236
    finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1237
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1238
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1239
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1240
    by (auto simp: simplicial_simplex feq  simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1241
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1242
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1243
definition simplicial_cone
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1244
  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
  1245
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1246
lemma simplicial_chain_simplicial_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1247
  assumes c: "simplicial_chain p S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1248
    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
  1249
  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
  1250
  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
  1251
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1252
  case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1253
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1254
    by (simp add: T simplicial_simplex_simplex_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1255
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1256
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1257
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1258
    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
  1259
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1260
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1261
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1262
lemma chain_boundary_simplicial_cone_of':
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1263
  assumes "f = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1264
  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
  1265
         frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1266
         - (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
  1267
            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
  1268
proof (simp, intro impI conjI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1269
  assume "p = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1270
  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
  1271
    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
  1272
  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
  1273
        = 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
  1274
    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
  1275
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1276
  assume "0 < p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1277
  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
  1278
         = oriented_simplex p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1279
              (\<lambda>j. if j < Suc x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1280
                   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
  1281
                   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
  1282
    using \<open>0 < p\<close> that
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1283
    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
  1284
  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
  1285
                     (\<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
  1286
         = - (\<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
  1287
               (frag_of (singular_face (Suc p) k (simplex_cone p v (oriented_simplex p l)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1288
    apply (subst sum.atLeast_Suc_atMost_Suc_shift)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1289
    apply (simp add: frag_extend_sum frag_extend_cmul flip: sum_negf)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1290
    apply (auto simp: simplex_cone singular_face_oriented_simplex 0 intro: sum.cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1291
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1292
  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
  1293
                    = oriented_simplex p l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1294
    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
  1295
  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
  1296
        = 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
  1297
    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
  1298
    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
  1299
    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
  1300
     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
  1301
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1302
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1303
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1304
lemma chain_boundary_simplicial_cone_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1305
  assumes "simplicial_simplex p S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1306
  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
  1307
         frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1308
         - (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
  1309
            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
  1310
  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
  1311
  by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1312
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1313
lemma chain_boundary_simplicial_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1314
  "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1315
   \<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
  1316
       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
  1317
            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
  1318
  unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1319
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1320
  case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1321
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1322
    by (auto simp: chain_boundary_simplicial_cone_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1323
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
  1324
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1325
lemma simplex_map_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1326
  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
  1327
    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
  1328
  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
  1329
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1330
  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
  1331
    using g by (auto simp: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1332
  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
  1333
    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
  1334
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1335
    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
  1336
      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
  1337
      unfolding simplicial_simplex_oriented_simplex by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1338
    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
  1339
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1340
      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
  1341
        using l by (simp add: simplicial_simplex_oriented_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1342
      have p: "l j \<in> (\<lambda>x i. \<Sum>j\<le>p. l j i * x j) ` standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1343
        apply (rule_tac x="(\<lambda>i. if i = j then 1 else 0)" in rev_image_eqI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1344
        using \<open>j\<le>p\<close> by (force simp: basis_in_standard_simplex if_distrib cong: if_cong)+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1345
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1346
        apply (rule subsetD [OF 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
  1347
        apply (rule subsetD [OF q p])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1348
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1349
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1350
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1351
      apply (simp add: geq oriented_simplex_def sum_distrib_left sum_distrib_right mult.assoc ssr lss)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1352
      by (rule sum.swap)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1353
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1354
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1355
    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
  1356
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1357
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1358
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1359
lemma chain_map_simplicial_cone:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1360
  assumes g: "simplicial_simplex r S g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1361
      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
  1362
      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
  1363
  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
  1364
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1365
  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
  1366
    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
  1367
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1368
    have "simplicial_simplex p (standard_simplex q) f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1369
      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
  1370
    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
  1371
      by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1372
    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
  1373
      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
  1374
    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
  1375
                      (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
  1376
      using convex_standard_simplex v
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1377
      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
  1378
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1379
      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
  1380
            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
  1381
      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
  1382
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1383
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1384
    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
  1385
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1386
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1387
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1388
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
  1389
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1390
definition simplicial_vertex
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1391
  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
  1392
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1393
lemma simplicial_vertex_oriented_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1394
   "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
  1395
  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
  1396
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1397
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1398
primrec simplicial_subdivision
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1399
where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1400
  "simplicial_subdivision 0 = id"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1401
| "simplicial_subdivision (Suc p) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1402
     frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1403
      (\<lambda>f. simplicial_cone p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1404
            (\<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
  1405
            (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
  1406
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1407
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1408
lemma simplicial_subdivision_0 [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1409
   "simplicial_subdivision p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1410
  by (induction p) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1411
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1412
lemma simplicial_subdivision_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1413
   "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
  1414
  by (induction p) (auto simp: frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1415
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1416
lemma simplicial_subdivision_of:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1417
   "simplicial_subdivision p (frag_of f) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1418
         (if p = 0 then frag_of f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1419
         else simplicial_cone (p -1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1420
               (\<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
  1421
               (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
  1422
  by (induction p) (auto simp: add.commute)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1423
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_chain_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1426
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1427
           \<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
  1428
proof (induction p arbitrary: S c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1429
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1430
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1431
    using Suc.prems [unfolded simplicial_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1432
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1433
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1434
    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
  1435
      by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1436
    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
  1437
                 (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
  1438
      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
  1439
    moreover
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1440
    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
  1441
      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
  1442
      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
  1443
    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
  1444
      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
  1445
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1446
      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
  1447
        using y feq by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1448
      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
  1449
      proof (rule l)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1450
        have i2p: "inverse (2 + real p) \<le> 1"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1451
          by (simp add: divide_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1452
        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)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1453
          using x \<open>0 \<le> u\<close> \<open>u \<le> 1\<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
  1454
          apply (simp add: sum.distrib standard_simplex_def i2p 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
  1455
          apply (simp add: divide_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1456
          done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1457
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1458
      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
  1459
                   = (\<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
  1460
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1461
        fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1462
        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
  1463
            = (\<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
  1464
          by (simp add: field_simps cong: sum.cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1465
        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
  1466
          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
  1467
        finally show "?lhs = ?rhs" .
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
      ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1470
        using feq x yeq
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1471
        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
  1472
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1473
    ultimately show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1474
      by (simp add: simplicial_chain_simplicial_cone)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1475
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1476
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1477
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1478
      by (metis simplicial_chain_diff simplicial_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1479
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1480
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1481
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1482
lemma chain_boundary_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1483
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1484
    \<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
  1485
proof (induction p arbitrary: c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1486
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1487
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1488
    using Suc.prems [unfolded simplicial_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1489
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1490
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1491
    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
  1492
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1493
    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
  1494
      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
  1495
    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
  1496
      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
  1497
    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
  1498
      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
  1499
    ultimately show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1500
      apply (simp add: chain_boundary_simplicial_cone Suc)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1501
       apply (auto simp: chain_boundary_of frag_extend_diff simplicial_cone_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1502
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1503
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1504
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1505
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1506
      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
  1507
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1508
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1509
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1510
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1511
(*A MESS AND USED ONLY ONCE*)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1512
lemma simplicial_subdivision_shrinks:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1513
   "\<lbrakk>simplicial_chain p S c;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1514
     \<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
  1515
     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
  1516
     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
  1517
    \<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
  1518
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
  1519
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1520
  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
  1521
  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
  1522
  have *: "Poly_Mapping.keys
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1523
             (simplicial_cone p (Sigp f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1524
               (simplicial_subdivision p (?CB f)))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1525
           \<subseteq> {f. \<forall>x\<in>standard_simplex (Suc p). \<forall>y\<in>standard_simplex (Suc p).
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1526
                      \<bar>f x k - f y k\<bar> \<le> real (Suc p) / real (Suc p + 1) * d}" (is "?lhs \<subseteq> ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1527
    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
  1528
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1529
    have ssf: "simplicial_simplex (Suc p) S f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1530
      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
  1531
    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
  1532
      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
  1533
    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
  1534
      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
  1535
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1536
      have 1: "simplicial_chain p S (?CB f)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1537
        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
  1538
      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
  1539
        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
  1540
      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
  1541
                         \<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
  1542
        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
  1543
      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
  1544
                          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
  1545
        using Suc.prems(2) f sc_sub
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1546
        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
  1547
      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
  1548
            \<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
  1549
        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
  1550
      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
  1551
        using that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1552
      have "d \<ge> 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1553
        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
  1554
      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
  1555
      proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1556
        have "simplicial_simplex p (f ` standard_simplex(Suc p)) g"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1557
          by (metis (mono_tags, hide_lams) sc_sub mem_Collect_eq simplicial_chain_def simplicial_chain_simplicial_subdivision subsetD that)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1558
        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
  1559
          and geq: "g = oriented_simplex p m"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1560
          using ssf by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1561
        have m_in_gim: "\<And>i. i \<le> p \<Longrightarrow> m i \<in> g ` standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1562
          apply (rule_tac x = "\<lambda>j. if j = i then 1 else 0" in image_eqI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1563
           apply (simp_all add: geq oriented_simplex_def if_distrib cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1564
          done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1565
        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
  1566
          and feq: "f = oriented_simplex (Suc p) l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1567
          using ssf by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1568
        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
  1569
        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
  1570
          fix x y
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1571
          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
  1572
          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
  1573
            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
  1574
            by (auto simp: standard_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1575
          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
  1576
                 (\<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
  1577
                \<le> (1 + real p) * d / (2 + real p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1578
          proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1579
            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
  1580
              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
  1581
            proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1582
              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
  1583
                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
  1584
              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
  1585
                using feq unfolding oriented_simplex_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1586
              show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1587
                unfolding eq
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1588
              proof (rule convex_sum_bound_le)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1589
                fix i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1590
                assume i: "i \<in> {..Suc p}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1591
                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
  1592
                  by (simp add: card_Suc_Diff1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1593
                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
  1594
                  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
  1595
                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
  1596
                  by (rule sum.mono_neutral_right) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1597
                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
  1598
                proof (rule sum_bounded_above_divide)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1599
                  fix i' :: "nat"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1600
                  assume i': "i' \<in> {..Suc p} - {i}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1601
                  have lf: "\<And>r. r \<le> Suc p \<Longrightarrow> l r \<in> f ` standard_simplex(Suc p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1602
                    apply (rule_tac x="\<lambda>j. if j = r then 1 else 0" in image_eqI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1603
                     apply (auto simp: feq oriented_simplex_def if_distrib [of "\<lambda>x. _ * x"] cong: if_cong)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1604
                    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1605
                  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
  1606
                    using i i' lf [of i] lf [of i'] 2
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1607
                    by (auto simp: divide_simps image_iff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1608
                qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1609
                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
  1610
                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
  1611
                  by (rule order_trans [OF sum_abs])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1612
                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
  1613
                  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
  1614
              qed (use standard_simplex_def z in auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1615
            qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1616
            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
  1617
              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
  1618
            proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1619
              have "?lhs \<le> (p / (Suc p)) * d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1620
                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
  1621
              also have "\<dots> \<le> ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1622
                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
  1623
              finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1624
            qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1625
            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
  1626
                \<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
  1627
                     (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
  1628
                     \<le> (1 + real p) * d / (2 + real p)" for j j'
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1629
              apply (rule_tac a=j and b = "j'" in linorder_less_wlog)
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
  1630
                apply (force simp: zero nonz \<open>0 \<le> d\<close> simp del: sum.atMost_Suc)+
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1631
              done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1632
            show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1633
              apply (rule convex_sum_bound_le)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1634
              using x' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1635
              using x' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1636
              apply (subst abs_minus_commute)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1637
              apply (rule convex_sum_bound_le)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1638
              using y' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1639
              using y' apply blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1640
              using jj by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1641
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1642
          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>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1643
                \<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
  1644
            apply (simp add: feq Sigp_def simplicial_vertex_oriented_simplex simplex_cone 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
  1645
            apply (simp add: oriented_simplex_def x y del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1646
            done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1647
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1648
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1649
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1650
        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
  1651
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1652
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1653
      unfolding simplicial_chain_def simplicial_cone_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1654
      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
  1655
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1656
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1657
    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
  1658
    apply (simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1659
    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
  1660
    apply (simp del: sum.atMost_Suc)
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1661
    apply clarify (*OBTAIN?*)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1662
    apply (rename_tac FFF)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1663
    using *
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1664
    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
  1665
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1666
qed (auto simp: standard_simplex_0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1667
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1668
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1669
subsection\<open>Singular subdivision\<close>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1670
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1671
definition singular_subdivision
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1672
  where "singular_subdivision p \<equiv>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1673
        frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1674
           (\<lambda>f. chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1675
                  (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1676
                         (frag_of(restrict id (standard_simplex p)))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1677
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1678
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
  1679
  by (simp add: singular_subdivision_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1680
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1681
lemma singular_subdivision_add:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1682
   "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
  1683
  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
  1684
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1685
lemma singular_subdivision_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1686
   "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
  1687
  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
  1688
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1689
lemma simplicial_simplex_id [simp]:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1690
   "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
  1691
    (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1692
proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1693
  assume ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1694
  then show ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1695
    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
  1696
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1697
  assume R: ?rhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1698
  then have cm: "continuous_map
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1699
                 (subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1700
                 (subtopology (powertop_real UNIV) S) id"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1701
    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
  1702
  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
  1703
    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
  1704
    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
  1705
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1706
  ultimately show ?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1707
    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
  1708
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1709
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1710
lemma singular_chain_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1711
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1712
        \<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
  1713
  unfolding singular_subdivision_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1714
  apply (rule singular_chain_extend)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1715
  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
  1716
                          (standard_simplex p)"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1717
  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
  1718
  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
  1719
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1720
lemma naturality_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1721
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1722
    \<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
  1723
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1724
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1725
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1726
  then have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1727
    by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1728
  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
  1729
    \<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
  1730
    unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1731
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1732
    case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1733
    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
  1734
      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
  1735
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1736
      by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1737
  qed (auto simp: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1738
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1739
    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
  1740
    by (simp add: singular_subdivision_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1741
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1742
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1743
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1744
    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
  1745
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1746
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1747
lemma simplicial_chain_chain_map:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1748
  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
  1749
  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
  1750
  using c unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1751
proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1752
  case (one g)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1753
  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
  1754
                 (oriented_simplex p m) = oriented_simplex p n"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1755
    if m: "singular_simplex p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1756
                (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
  1757
    for l m
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1758
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1759
    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
  1760
      if "x \<in> standard_simplex p" for x
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1761
      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
  1762
      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
  1763
    then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1764
      unfolding oriented_simplex_def simplex_map_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1765
      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
  1766
      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
  1767
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1768
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1769
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1770
    using f one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1771
    apply (auto simp: simplicial_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1772
    apply (rule singular_simplex_simplex_map
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1773
        [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
  1774
    unfolding singular_simplex_def apply (fastforce simp add:)+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1775
    done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1776
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1777
  case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1778
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1779
    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
  1780
qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1781
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1782
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1783
lemma singular_subdivision_simplicial_simplex:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1784
   "simplicial_chain p S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1785
           \<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
  1786
proof (induction p arbitrary: S c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1787
  case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1788
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1789
    unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1790
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1791
    case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1792
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1793
      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
  1794
      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
  1795
  qed (auto simp: singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1796
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1797
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1798
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1799
    using Suc.prems unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1800
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1801
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1802
    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
  1803
      by (auto simp: simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1804
    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
  1805
                   (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1806
                     (chain_boundary (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1807
                       (frag_of (restrict id (standard_simplex (Suc p))))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1808
      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
  1809
    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
  1810
                  \<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
  1811
      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
  1812
    have ss_Sp: "(\<lambda>i. (if i \<le> Suc p then 1 else 0) / (real p + 2)) \<in> standard_simplex (Suc p)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1813
      by (simp add: standard_simplex_def divide_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1814
    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
  1815
      using one unfolding simplicial_simplex by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1816
    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
  1817
                = (\<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
  1818
      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
  1819
      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
  1820
    have scp: "singular_chain (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1821
                 (subtopology (powertop_real UNIV) (standard_simplex (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 (simp add: simplicial_imp_singular_chain)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1824
    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
  1825
                  (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
  1826
      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
  1827
    have scpf: "simplicial_chain p S
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1828
                 (chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1829
                   (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
  1830
      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
  1831
    have 4: "chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1832
                (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1833
                   (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
  1834
           = 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
  1835
      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
  1836
          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
  1837
      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
  1838
    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
  1839
      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
  1840
      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
  1841
      done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1842
  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
  1843
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1844
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1845
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1846
lemma naturality_simplicial_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1847
   "\<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
  1848
    \<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
  1849
apply (simp flip: singular_subdivision_simplicial_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1850
  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
  1851
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1852
lemma chain_boundary_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1853
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1854
        \<Longrightarrow> chain_boundary p (singular_subdivision p c) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1855
            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
  1856
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1857
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1858
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1859
    then have ssf: "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1860
      by (auto simp: singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1861
    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
  1862
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1863
    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
  1864
                  (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
  1865
      using simplicial_chain_boundary by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1866
    have sgp1: "singular_chain (p - Suc 0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1867
                   (subtopology (powertop_real UNIV) (standard_simplex p))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1868
                   (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
  1869
      using scp1 simplicial_imp_singular_chain by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1870
    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
  1871
                  (frag_of (restrict id (standard_simplex p)))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1872
      using scp simplicial_imp_singular_chain by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1873
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1874
      unfolding singular_subdivision_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1875
      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
  1876
                              (standard_simplex p)" _ f]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1877
      apply (simp add: simplicial_chain_simplicial_subdivision
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1878
          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
  1879
          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
  1880
      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
  1881
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
  1882
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1883
lemma singular_subdivision_zero:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1884
  "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
  1885
  unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1886
proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1887
  case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1888
  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
  1889
    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
  1890
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1891
    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
  1892
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
  1893
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1894
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1895
primrec subd where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1896
  "subd 0 = (\<lambda>x. 0)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1897
| "subd (Suc p) =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1898
      frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1899
       (\<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
  1900
               (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
  1901
                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
  1902
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1903
lemma subd_0 [simp]: "subd p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1904
  by (induction p) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1905
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1906
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
  1907
  by (induction p) (auto simp: 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
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
  1910
  by (metis diff_0 subd_0 subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1911
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1912
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
  1913
  apply (induction k, simp_all)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1914
  by (metis minus_frag_cmul subd_uminus)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1915
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1916
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
  1917
  apply (induction I rule: infinite_finite_induct)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1918
  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
  1919
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1920
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
  1921
     \<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
  1922
         \<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
  1923
         \<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
  1924
proof (induction p arbitrary: c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1925
  case (Suc p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1926
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1927
    using Suc.prems [unfolded simplicial_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1928
  proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1929
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1930
    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
  1931
                  and feq: "f = oriented_simplex (Suc p) l"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1932
      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
  1933
    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
  1934
      using one by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1935
    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
  1936
    proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1937
      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
  1938
        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
  1939
      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
  1940
        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
  1941
      ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1942
        by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1943
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1944
    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
  1945
     \<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
  1946
    proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1947
      case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1948
      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
  1949
      have "?x \<in> standard_simplex s"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1950
      proof (rule convex_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1951
        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
  1952
          using Suc by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1953
      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
  1954
      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
  1955
        by (force simp: divide_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1956
      ultimately show ?case
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 auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1959
    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
  1960
      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
  1961
    show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1962
    proof (intro conjI impI allI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1963
      fix r g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1964
      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
  1965
      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
  1966
        using simplicial_simplex by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1967
      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
  1968
        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
  1969
      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
  1970
             = (\<Sum>j\<le>Suc p. simplicial_vertex j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1971
                                (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
  1972
      proof (rule sum.cong [OF refl])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1973
        fix j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1974
        assume j: "j \<in> {..Suc p}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1975
        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
  1976
                = 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
  1977
        proof (rule simplex_map_oriented_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1978
          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
  1979
            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
  1980
          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
  1981
            using g by (simp add: geq)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1982
        qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1983
        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
  1984
            = 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
  1985
          using one j
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1986
          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
  1987
          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
  1988
           apply (auto simp: oriented_simplex_def lss)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1989
          done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1990
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1991
      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
  1992
             = 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
  1993
        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
  1994
      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
  1995
        using g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1996
        apply (simp only: subd.simps frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1997
        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
  1998
           apply (intro simplicial_chain_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  1999
        using "1" apply auto[1]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2000
        using one.hyps apply auto[1]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2001
        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
  2002
        using "**" apply auto[1]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2003
         apply (rule order_refl)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2004
         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
  2005
        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
  2006
         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
  2007
        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
  2008
        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
  2009
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2010
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2011
      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
  2012
               (simplicial_cone p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2013
                 (\<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
  2014
                 (simplicial_subdivision p
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2015
                   (chain_boundary (Suc p) (frag_of f))))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2016
          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
  2017
      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
  2018
        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
  2019
      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
  2020
        using one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2021
        apply (simp only: subd.simps frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2022
        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
  2023
         apply (intro simplicial_chain_diff ff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2024
        using sc apply (simp add: algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2025
        using "**" convex_standard_simplex  apply force+
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2026
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2027
      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
  2028
        using scf simplicial_chain_boundary by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2029
      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
  2030
                                         - 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
  2031
        apply (simp only: chain_boundary_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2032
        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
  2033
                                (standard_simplex s)" "frag_of f"]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2034
        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
  2035
      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
  2036
          + 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
  2037
          = 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
  2038
        apply (simp only: subd.simps frag_extend_of)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2039
        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
  2040
         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
  2041
        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
  2042
        done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2043
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2044
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2045
    case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2046
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2047
      apply safe
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2048
        apply (metis chain_map_diff subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2049
       apply (metis simplicial_chain_diff subd_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2050
      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
  2051
          simp del: simplicial_subdivision.simps subd.simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2052
      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
  2053
  qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2054
qed simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2055
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2056
lemma chain_homotopic_simplicial_subdivision1:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2057
  "\<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
  2058
       \<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
  2059
  by (simp add: subd)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2060
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2061
lemma chain_homotopic_simplicial_subdivision2:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2062
  "simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2063
       \<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
  2064
  by (simp add: subd)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2065
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2066
lemma chain_homotopic_simplicial_subdivision3:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2067
  "simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2068
   \<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
  2069
  by (simp add: subd algebra_simps)
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_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2072
  "\<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
  2073
       (\<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
  2074
       (\<forall>p q r g c.
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2075
                simplicial_chain p (standard_simplex q) c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2076
                \<longrightarrow> simplicial_simplex q (standard_simplex r) g
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2077
                \<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
  2078
       (\<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
  2079
                \<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
  2080
       (\<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
  2081
                \<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
  2082
                  = (simplicial_subdivision p c) - c)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2083
  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
  2084
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2085
lemma chain_homotopic_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2086
  obtains h where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2087
        "\<And>p. h p 0 = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2088
        "\<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
  2089
        "\<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
  2090
        "\<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
  2091
                 \<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
  2092
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2093
  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
  2094
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2095
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2096
    fix p X and c :: "'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2097
    assume c: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2098
    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
  2099
               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
  2100
      using c [unfolded singular_chain_def]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2101
    proof (induction rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2102
      case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2103
      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
  2104
      show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2105
      proof (simp add: k_def, intro conjI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2106
        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
  2107
        proof (rule singular_chain_chain_map)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2108
          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
  2109
            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
  2110
          show "continuous_map ?X X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2111
            using one.hyps singular_simplex_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2112
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2113
      next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2114
        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
  2115
          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
  2116
        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
  2117
          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
  2118
        have *: "chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2119
                   (subd (p - Suc 0)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2120
                     (\<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
  2121
              = (\<Sum>x\<le>p. frag_cmul ((-1) ^ x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2122
                         (chain_map p (singular_face p x f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2123
                           (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
  2124
                  (is "?lhs = ?rhs")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2125
                  if "p > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2126
        proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2127
          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
  2128
                   = chain_map p (singular_face p i id)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2129
                                 (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
  2130
            if "i \<le> p" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2131
          proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2132
            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
  2133
                       (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
  2134
              by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2135
            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
  2136
              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
  2137
            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
  2138
                   = singular_face p i id"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2139
              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
  2140
            show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2141
              using chain_homotopic_simplicial_subdivision1 [OF 1 2]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2142
                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
  2143
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2144
          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
  2145
                    (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
  2146
            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
  2147
          have yy: "\<And>k. k \<le> p \<Longrightarrow>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2148
                 chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2149
                  (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
  2150
            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
  2151
            using that unfolding simplicial_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2152
          proof (induction h rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2153
            case (one x)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2154
            then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2155
                using one
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2156
              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
  2157
                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
  2158
                apply (simp add: simplex_map_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2159
                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
  2160
          qed (auto simp: chain_map_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2161
          have "?lhs
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2162
                = chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2163
                      (\<Sum>k\<le>p. frag_cmul ((-1) ^ k)
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)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2165
                           (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
  2166
            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
  2167
          also have "\<dots> = ?rhs"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2168
            by (simp add: chain_map_sum xx yy)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2169
          finally show ?thesis .
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2170
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2171
        have "chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2172
                   (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
  2173
                   - 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
  2174
              = singular_subdivision p (frag_of f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2175
              - frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2176
                   (\<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
  2177
                         (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
  2178
                   (chain_boundary p (frag_of f))"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2179
          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
  2180
          apply (clarsimp simp add: chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2181
          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
  2182
          done
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2183
        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
  2184
                 + frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2185
                   (\<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
  2186
                         (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
  2187
                   (chain_boundary p (frag_of f))
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2188
                 = 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
  2189
          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
  2190
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2191
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2192
      case (diff a b)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2193
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2194
        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
  2195
        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
  2196
    qed (auto simp: k_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2197
    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
  2198
        by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2199
  qed (auto simp: k_def frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2200
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2201
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2202
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2203
lemma homologous_rel_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2204
  assumes "singular_relcycle p X T c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2205
  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
  2206
proof (cases "p = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2207
  case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2208
  with assms show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2209
    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
  2210
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2211
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2212
  with assms show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2213
    unfolding homologous_rel_def singular_relboundary singular_relcycle
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2214
    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
  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
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
  2219
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2220
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
  2221
  by (induction n) auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2222
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2223
lemma singular_subdivision_power_diff:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2224
  "(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
  2225
  by (induction n) (auto simp: singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2226
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2227
lemma iterated_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2228
   "singular_chain p X c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2229
        \<Longrightarrow> (singular_subdivision p ^^ n) c =
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2230
            frag_extend
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2231
             (\<lambda>f. chain_map p f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2232
                       ((simplicial_subdivision p ^^ n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2233
                         (frag_of(restrict id (standard_simplex p))))) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2234
proof (induction n arbitrary: c)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2235
  case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2236
  then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2237
    unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2238
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2239
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2240
    then have "restrict f (standard_simplex p) = f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2241
      by (simp add: extensional_restrict singular_simplex_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2242
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2243
      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
  2244
  qed (auto simp: frag_extend_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2245
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2246
  case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2247
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2248
    using Suc.prems unfolding singular_chain_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2249
  proof (induction c rule: frag_induction)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2250
    case (one f)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2251
    then have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2252
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2253
    have scp: "simplicial_chain p (standard_simplex p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2254
                 ((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
  2255
    proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2256
      case 0
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 (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
  2259
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2260
      case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2261
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2262
        by (simp add: simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2263
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2264
    have scnp: "simplicial_chain p (standard_simplex p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2265
                  ((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
  2266
    proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2267
      case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2268
      then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2269
        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
  2270
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2271
      case (Suc n)
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 (simp add: simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2274
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2275
    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
  2276
      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
  2277
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2278
      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
  2279
      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
  2280
  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
  2281
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2282
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2283
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2284
lemma chain_homotopic_iterated_singular_subdivision:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2285
  obtains h where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2286
        "\<And>p. h p 0 = (0 :: 'a chain)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2287
        "\<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
  2288
        "\<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
  2289
        "\<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
  2290
                 \<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
  2291
                   = (singular_subdivision p ^^ n) c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2292
proof (induction n arbitrary: thesis)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2293
  case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2294
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2295
    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
  2296
next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2297
  case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2298
  then obtain k where k:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2299
        "\<And>p. k p 0 = (0 :: 'a chain)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2300
        "\<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
  2301
        "\<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
  2302
        "\<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
  2303
                 \<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
  2304
                     = (singular_subdivision p ^^ n) c - c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2305
    by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2306
  obtain h where h:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2307
        "\<And>p. h p 0 = (0 :: 'a chain)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2308
        "\<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
  2309
        "\<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
  2310
        "\<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
  2311
                 \<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
  2312
    by (blast intro: chain_homotopic_singular_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2313
  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
  2314
  show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2315
  proof (rule Suc.prems)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2316
    fix p X and c :: "'a chain"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2317
    assume "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2318
    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
  2319
      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
  2320
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2321
    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
  2322
    assume sc: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2323
    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
  2324
      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
  2325
    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
  2326
                  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
  2327
    proof (cases p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2328
      case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2329
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2330
        by (simp add: k chain_boundary_def)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2331
    qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2332
    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
  2333
      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
  2334
      apply (simp add: chain_boundary_add f5 h k algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2335
      apply (erule thin_rl)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2336
      using h(4) [OF sc] k(4) [OF sc] singular_subdivision_add [of p "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
  2337
      apply (simp add: algebra_simps)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2338
      by (smt add.assoc add.left_commute singular_subdivision_add)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2339
  qed (auto simp: k h singular_subdivision_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2340
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2341
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2342
lemma llemma:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2343
  assumes p: "standard_simplex p \<subseteq> \<Union>\<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2344
      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
  2345
  obtains d where "0 < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2346
                  "\<And>K. \<lbrakk>K \<subseteq> standard_simplex p;
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2347
                        \<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
  2348
                       \<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
  2349
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2350
  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
  2351
                (\<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
  2352
    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
  2353
  proof-
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2354
    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
  2355
      using x p by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2356
    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
  2357
                  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
  2358
      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
  2359
    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
  2360
      using PiE_mem [OF xV] by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2361
    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
  2362
      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
  2363
    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
  2364
      by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2365
    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
  2366
    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
  2367
      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
  2368
    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
  2369
                (\<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
  2370
    proof (intro exI conjI allI impI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2371
      show "e > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2372
        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
  2373
      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
  2374
      have "y \<in> Pi\<^sub>E UNIV V"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2375
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2376
        show "y i \<in> V i" for i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2377
        proof (cases "p < i")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2378
          case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2379
          then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2380
            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
  2381
        next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2382
          case False show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2383
          proof (cases "V i = UNIV")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2384
            case False show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2385
            proof (rule dV)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2386
              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
  2387
                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
  2388
              also have "\<dots> < d i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2389
                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
  2390
              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
  2391
            qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2392
          qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2393
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2394
      qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2395
      with UV show "y \<in> U"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2396
        by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2397
    qed (use U in auto)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2398
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2399
  then obtain e U where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2400
      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
  2401
                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
  2402
      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
  2403
                       \<Longrightarrow> y \<in> U x"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2404
    by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2405
  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
  2406
  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
  2407
    by (simp add: F_def openin_PiE_gen)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2408
  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
  2409
    by (force simp: F_def PiE_iff eU)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2410
  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
  2411
    using compactin_standard_simplex [of p]
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2412
    unfolding compactin_def by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2413
  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
  2414
    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
  2415
  then have "S \<noteq> {}"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2416
    by (auto simp: nonempty_standard_simplex)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2417
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2418
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2419
    show "Inf (e ` S) > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2420
      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
  2421
    fix k :: "(nat \<Rightarrow> real) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2422
    assume k: "k \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2423
         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
  2424
    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
  2425
    proof (cases "k = {}")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2426
      case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2427
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2428
        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
  2429
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2430
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2431
      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
  2432
                            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
  2433
        by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2434
      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
  2435
        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
  2436
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2437
      proof (intro exI conjI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2438
        show "U a \<in> \<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2439
          using a eU ssp(1) by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2440
        show "k \<subseteq> U a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2441
        proof clarify
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2442
          fix y assume "y \<in> k"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2443
          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
  2444
            by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2445
          show "y \<in> U a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2446
          proof (rule UI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2447
            show "a \<in> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2448
              using a ssp(1) by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2449
            fix i :: "nat"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2450
            assume "i \<le> p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2451
            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
  2452
              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
  2453
            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
  2454
              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
  2455
          next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2456
            fix i assume "p < i"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2457
            then show "y i = 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2458
              using standard_simplex_def y by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2459
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2460
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2461
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2462
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2463
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2464
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2465
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2466
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2467
proposition sufficient_iterated_singular_subdivision_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2468
  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
  2469
      and X: "topspace X \<subseteq> \<Union>\<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2470
      and p: "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2471
  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
  2472
                      \<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
  2473
proof (cases "c = 0")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2474
  case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2475
  then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2476
  proof (cases "topspace X = {}")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2477
    case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2478
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2479
      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
  2480
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2481
    case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2482
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2483
    proof (cases "\<C> = {}")
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2484
      case True
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2485
      then show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2486
        using False X by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2487
    next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2488
      case False
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2489
      have "\<exists>e. 0 < e \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2490
                (\<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
  2491
                     \<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
  2492
        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
  2493
      proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2494
        have ssf: "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2495
          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
  2496
        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
  2497
          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
  2498
        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
  2499
                    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
  2500
          if V: "V \<in> \<C>" for V
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2501
        proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2502
          have "singular_simplex p X f"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2503
            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
  2504
          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
  2505
                            {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
  2506
            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
  2507
          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
  2508
            by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2509
          ultimately show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2510
            by (simp add: openin_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2511
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2512
        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
  2513
                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
  2514
          by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2515
        obtain d where "0 < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2516
              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
  2517
                       \<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
  2518
        proof (rule llemma [of p "g ` \<C>"])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2519
          show "standard_simplex p \<subseteq> \<Union>(g ` \<C>)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2520
            using geq X fp by (fastforce simp add:)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2521
          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
  2522
            using gope that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2523
        qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2524
        show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2525
        proof (rule exI, intro allI conjI impI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2526
          fix K :: "(nat \<Rightarrow> real) set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2527
          assume K: "K \<subseteq> standard_simplex p"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2528
             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
  2529
          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
  2530
            using d [OF K] by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2531
          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
  2532
            using K geq by fastforce
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2533
        qed (rule \<open>d > 0\<close>)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2534
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2535
      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
  2536
                 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
  2537
                                \<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
  2538
                               \<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
  2539
        by metis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2540
      obtain d where "0 < d"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2541
               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
  2542
                              \<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
  2543
                              \<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
  2544
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2545
        show "Inf (\<psi> ` Poly_Mapping.keys c) > 0"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2546
          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
  2547
        fix f K
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2548
        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
  2549
          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
  2550
        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
  2551
          by (auto intro: cInf_le_finite)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2552
        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
  2553
          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
  2554
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2555
      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
  2556
      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
  2557
        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
  2558
      show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2559
      proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2560
        fix m h
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2561
        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
  2562
        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
  2563
          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
  2564
        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
  2565
          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
  2566
        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
  2567
                  (\<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
  2568
                       \<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
  2569
          for n i
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2570
        proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2571
          case 0
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2572
          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
  2573
            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
  2574
          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
  2575
            unfolding standard_simplex_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2576
            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
  2577
          ultimately show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2578
            unfolding power_0 funpow_0 by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2579
        next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2580
          case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2581
          show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2582
            unfolding power_Suc funpow.simps o_def
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2583
          proof (intro conjI ballI)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2584
            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
  2585
              by (simp add: Suc simplicial_chain_simplicial_subdivision)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2586
            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
  2587
              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
  2588
                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
  2589
              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
  2590
          qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2591
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2592
        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
  2593
          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
  2594
        moreover
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2595
        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
  2596
        proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2597
          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
  2598
            using g xx [of m] that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2599
          also have "\<dots> \<le> (p / (Suc p)) ^ n"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2600
            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
  2601
          finally show ?thesis using n by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2602
        qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2603
        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
  2604
          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
  2605
          using that by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2606
        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
  2607
          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
  2608
          by (simp add: Bex_def heq image_image)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2609
      qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2610
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2611
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2612
qed force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2613
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2614
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2615
lemma small_homologous_rel_relcycle_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2616
  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
  2617
      and X: "topspace X \<subseteq> \<Union>\<C>"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2618
      and p: "singular_relcycle p X S c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2619
    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
  2620
                      "\<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
  2621
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2622
  have "singular_chain p X c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2623
       "(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
  2624
    using p unfolding singular_relcycle_def by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2625
  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
  2626
                            \<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
  2627
    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
  2628
  let ?c' = "(singular_subdivision p ^^ n) c"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2629
  show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2630
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2631
    show "homologous_rel p X S c ?c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2632
      apply (induction n, simp_all)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2633
      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
  2634
    then show "singular_relcycle p X S ?c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2635
      by (metis homologous_rel_singular_relcycle p)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2636
  next
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2637
    fix f :: "(nat \<Rightarrow> real) \<Rightarrow> 'a"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2638
    assume "f \<in> Poly_Mapping.keys ?c'"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2639
    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
  2640
      by (rule n [OF order_refl])
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2641
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2642
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2643
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2644
lemma excised_chain_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2645
  fixes S :: "'a set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2646
  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
  2647
  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
  2648
                      "singular_chain p (subtopology X T) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2649
                      "(singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2650
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2651
  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
  2652
                  singular_chain p (subtopology X T) e \<and>
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2653
                  (singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2654
    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
  2655
       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
  2656
       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
  2657
  proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2658
    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
  2659
                             \<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
  2660
      apply (rule sufficient_iterated_singular_subdivision_exists
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2661
                   [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
  2662
      using X S c
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2663
      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
  2664
    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
  2665
    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
  2666
      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
  2667
    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
  2668
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2669
    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
  2670
                              \<union> singular_simplex_set p (subtopology X T)"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2671
    proof (clarsimp)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2672
      fix f
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2673
      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
  2674
         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
  2675
      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
  2676
        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
  2677
        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
  2678
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2679
    show ?thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2680
       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
  2681
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2682
  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
  2683
    by (metis subtopology_subtopology subtopology_topspace)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2684
  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
  2685
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2686
  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
  2687
    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
  2688
  obtain n d e where
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2689
    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
  2690
    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
  2691
    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
  2692
    using *[OF c Xsub, simplified] assms by force
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2693
  show thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2694
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2695
    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
  2696
      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
  2697
    show "singular_chain p (subtopology X T) e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2698
      by (metis e inf.cobounded2 singular_chain_mono)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2699
    show "(singular_subdivision p ^^ n) c = d + e"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2700
      by (rule de)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2701
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2702
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2703
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2704
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2705
lemma excised_relcycle_exists:
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2706
  fixes S :: "'a set"
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2707
  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
  2708
      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
  2709
  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
  2710
                   "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
  2711
proof -
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2712
  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
  2713
    using \<open>T \<subseteq> S\<close> by auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2714
  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
  2715
    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
  2716
    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
  2717
  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
  2718
    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
  2719
    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
  2720
    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
  2721
  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
  2722
    by (simp add: singular_chain_boundary d)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2723
  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
  2724
    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
  2725
  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
  2726
  proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2727
    case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2728
    then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2729
      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
  2730
  qed (auto simp: scp1)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2731
  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
  2732
    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
  2733
  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
  2734
    by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2735
  show thesis
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2736
  proof
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2737
    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
  2738
      using scTd singular_chain_subtopology by blast
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2739
    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
  2740
      by (fastforce simp add: singular_chain_subtopology)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2741
    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
  2742
      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
  2743
    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
  2744
    proof (rule homologous_rel_diff)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2745
      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
  2746
      proof (induction n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2747
        case (Suc n)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2748
        then show ?case
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2749
          apply simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2750
          apply (rule homologous_rel_trans)
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2751
          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
  2752
      qed auto
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2753
      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
  2754
        unfolding homologous_rel_def using e
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2755
        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
  2756
    qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2757
    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
  2758
      by simp
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2759
  qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2760
qed
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  2761
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2762
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2763
subsection\<open>Homotopy invariance\<close>
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2764
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2765
theorem homotopic_imp_homologous_rel_chain_maps:
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2766
  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
  2767
  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
  2768
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
  2769
  note sum.atMost_Suc [simp del]
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2770
  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
  2771
    using homotopic_with_imp_continuous_maps [OF hom] by metis+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2772
  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
  2773
    and h0: "\<And>x. h(0, x) = f x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2774
    and h1: "\<And>x. h(1, x) = g x"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2775
    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
  2776
    using hom by (fastforce simp: homotopic_with_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2777
  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
  2778
  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
  2779
  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
  2780
  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
  2781
                                        (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
  2782
  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
  2783
    if "i \<le> q" for q i
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2784
  proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2785
    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
  2786
      if "x \<in> standard_simplex (Suc q)" for x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2787
    proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2788
      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
  2789
        using that unfolding standard_simplex_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2790
        by (force intro!: sum_mono)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2791
      with \<open>i \<le> q\<close> that show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2792
        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
  2793
    qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2794
    moreover
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2795
    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
  2796
      if "x \<in> standard_simplex (Suc q)" for x
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 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
  2799
        using that by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2800
      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
  2801
              = (\<Sum>j\<le>Suc q. x j)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2802
        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
  2803
      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
  2804
            \<le> sum x {..Suc q}" for k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2805
        using that unfolding standard_simplex_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2806
        by (force intro!: sum_mono)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2807
      then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2808
        using \<open>i \<le> q\<close> that
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2809
        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
  2810
            sum.swap [where A = "atMost q"] eq cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2811
    qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2812
    ultimately show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2813
      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
  2814
  qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2815
  obtain prism where prism: "\<And>q. prism q 0 = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2816
    "\<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
  2817
    "\<And>q c. singular_chain q (subtopology S T) c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2818
                           \<Longrightarrow> singular_chain (Suc q) (subtopology U V) (prism q c)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2819
    "\<And>q c. singular_chain q S c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2820
                           \<Longrightarrow> chain_boundary (Suc q) (prism q c) =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2821
                               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
  2822
  proof
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2823
    show "(frag_extend \<circ> pr) q 0 = 0" for q
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2824
      by (simp add: pr_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2825
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2826
    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
  2827
      if "singular_chain q S c" for q c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2828
      using that [unfolded singular_chain_def]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2829
    proof (induction c rule: frag_induction)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2830
      case (one m)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2831
      show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2832
      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
  2833
        fix i :: "nat"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2834
        assume "i \<in> {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2835
        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
  2836
        show "singular_chain (Suc q) U
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2837
                 (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
  2838
          unfolding singular_chain_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2839
        proof (rule singular_simplex_simplex_map)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2840
          show "singular_simplex (Suc q) X (simp q i)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2841
            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
  2842
          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
  2843
            unfolding continuous_map_in_subtopology topspace_subtopology X_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2844
            by (auto intro: continuous_map_product_projection continuous_map_from_subtopology)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2845
          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
  2846
          proof (rule continuous_map_compose)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2847
            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
  2848
              by (auto intro: continuous_map_product_projection)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2849
            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
  2850
              unfolding X_def o_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2851
              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
  2852
          qed (use one in \<open>simp add: singular_simplex_def\<close>)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2853
          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
  2854
            apply (rule continuous_map_compose [unfolded o_def, OF _ conth])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2855
            using 0 1 by (simp add: continuous_map_pairwise o_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2856
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2857
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2858
    next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2859
      case (diff a b)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2860
      then show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2861
        apply (simp add: frag_extend_diff keys_diff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2862
        using singular_chain_def singular_chain_diff by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2863
    qed auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2864
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2865
    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
  2866
      if "singular_chain q (subtopology S T) c" for q c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2867
      using that [unfolded singular_chain_def]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2868
    proof (induction c rule: frag_induction)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2869
      case (one m)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2870
      show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2871
      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
  2872
        fix i :: "nat"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2873
        assume "i \<in> {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2874
        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
  2875
        show "singular_chain (Suc q) (subtopology U V)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2876
                 (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
  2877
          unfolding singular_chain_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2878
        proof (rule singular_simplex_simplex_map)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2879
          show "singular_simplex (Suc q) X (simp q i)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2880
            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
  2881
          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
  2882
            unfolding continuous_map_in_subtopology topspace_subtopology X_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2883
            by (auto intro: continuous_map_product_projection continuous_map_from_subtopology)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2884
          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
  2885
          proof (rule continuous_map_compose)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2886
            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
  2887
              by (auto intro: continuous_map_product_projection)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2888
            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
  2889
              unfolding X_def o_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2890
              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
  2891
            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
  2892
              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
  2893
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2894
          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
  2895
          proof (rule continuous_map_compose)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2896
            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
  2897
              using 0 1 by (simp add: continuous_map_pairwise o_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2898
            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
  2899
              by (metis conth continuous_map_from_subtopology subtopology_Times subtopology_topspace)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2900
            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
  2901
              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
  2902
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2903
          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
  2904
            by (simp add: o_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2905
        qed
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
    next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2908
      case (diff a b)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2909
      then show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2910
        by (metis comp_apply frag_extend_diff singular_chain_diff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2911
    qed auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2912
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2913
    show "chain_boundary (Suc q) ((frag_extend \<circ> pr) q c) =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2914
        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
  2915
      if "singular_chain q S c" for q c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2916
      using that [unfolded singular_chain_def]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2917
    proof (induction c rule: frag_induction)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2918
      case (one m)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2919
      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
  2920
        by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2921
      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
  2922
                   frag_cmul (((-1) ^ i) * (-1) ^ j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2923
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2924
                        (singular_face (Suc q) j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2925
                          (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
  2926
             + (\<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
  2927
                     frag_cmul (- ((-1) ^ i * (-1) ^ j))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2928
                        (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2929
                          (singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2930
                            (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
  2931
             = 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
  2932
      proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2933
        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
  2934
          = restrict (g \<circ> m) (standard_simplex q)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2935
        proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2936
          fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2937
          assume x: "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2938
          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
  2939
            by (simp add: sum.atMost_Suc_shift)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2940
          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
  2941
            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
  2942
            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
  2943
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2944
          moreover
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2945
          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
  2946
            using standard_simplex_def x by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2947
          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
  2948
            unfolding oriented_simplex_def simp_def ww_def using x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2949
            apply (simp add: simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2950
            apply (simp add: simplical_face_def if_distrib)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2951
            apply (simp add: if_distribR if_distrib cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2952
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2953
          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
  2954
            by (simp add: o_def h1)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2955
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2956
        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
  2957
             = frag_of (simplex_map q g m)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2958
          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
  2959
        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
  2960
          = restrict (f \<circ> m) (standard_simplex q)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2961
        proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2962
          fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2963
          assume x: "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2964
          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
  2965
            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
  2966
            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
  2967
          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
  2968
            unfolding oriented_simplex_def simp_def vv_def using x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2969
            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
  2970
            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
  2971
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2972
          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
  2973
            by (simp add: o_def h0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2974
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2975
        then have b: "frag_of (singular_face (Suc q) (Suc q)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2976
                     (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
  2977
          = frag_of (simplex_map q f m)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2978
          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
  2979
        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
  2980
                = 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
  2981
          if "i < q" for i
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2982
          unfolding simplex_map_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2983
        proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2984
          fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2985
          assume "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2986
          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
  2987
            unfolding oriented_simplex_def simp_def simplical_face_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2988
            by (force intro: sum.cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2989
          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
  2990
                 = ((\<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
  2991
            by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2992
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2993
        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
  2994
          by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2995
        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
  2996
          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
  2997
        show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2998
          using a b
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  2999
          apply (simp add: sum.reindex inj_on_def eqq)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3000
          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
  3001
          done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3002
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3003
      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
  3004
                     frag_cmul ((-1) ^ i * (-1) ^ j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3005
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3006
                        (singular_face (Suc q) j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3007
                          (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
  3008
             + (\<Sum>(i,j)\<in>(SIGMA i:{..q}. {i..q} - {i}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3009
                 frag_cmul (- ((-1) ^ i * (-1) ^ j))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3010
                  (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3011
                    (singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3012
                      (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
  3013
             = - 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
  3014
      proof (cases "q=0")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3015
        case True
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3016
        then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3017
          by (simp add: chain_boundary_def flip: sum.Sigma)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3018
      next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3019
        case False
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3020
        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
  3021
          by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3022
        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
  3023
                    frag_cmul ((-1) ^ (i + j))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3024
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3025
                        (singular_face (Suc q) j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3026
                          (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
  3027
               = (\<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
  3028
                   frag_cmul (- ((-1) ^ (j + i)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3029
                    (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3030
                      (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
  3031
                        (simp (q - Suc 0) i))))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3032
        proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3033
          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
  3034
                       (simp (q - Suc 0) (i - Suc 0))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3035
                   = 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
  3036
            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
  3037
            unfolding simplex_map_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3038
          proof (rule restrict_ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3039
            fix x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3040
            assume x: "x \<in> standard_simplex q"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3041
            have "i > 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3042
              using that by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3043
            then have iq: "i - Suc 0 \<le> q - Suc 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3044
              using \<open>i \<le> q\<close> False by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3045
            have q0_eq: "{..Suc q} = insert 0 (Suc ` {..q})"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3046
              by (auto simp: image_def gr0_conv_Suc)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3047
            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
  3048
              using False x ij
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3049
              unfolding oriented_simplex_def simp_def vv_def ww_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3050
              apply (simp add: simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3051
              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
  3052
              done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3053
            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
  3054
            proof
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3055
              fix k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3056
              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
  3057
                  = (simp q i (simplical_face j x) \<circ> Suc) k"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3058
                using False x ij
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3059
                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
  3060
                apply (simp add: simplical_face_in_standard_simplex if_distribR)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3061
                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
  3062
                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
  3063
                 apply (force simp: sum.atMost_Suc intro: sum.cong)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3064
                apply (force simp: 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
            qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3067
            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
  3068
              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
  3069
              apply (simp add: simplicial_simplex image_subset_iff)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3070
              using \<open>x \<in> standard_simplex q\<close> by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3071
            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
  3072
                = ((\<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
  3073
              by (simp add: singular_face_def \<alpha> \<beta>)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3074
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3075
          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
  3076
          proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3077
            have "i + j > 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3078
              using that by blast
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3079
            then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3080
              by (metis (no_types, hide_lams) One_nat_def Suc_diff_1 add.inverse_inverse mult.left_neutral mult_minus_left power_Suc)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3081
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3082
          show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3083
            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
  3084
            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
  3085
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3086
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3087
        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
  3088
               = 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
  3089
          if ij: "i < j" "j \<le> q" for i j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3090
        proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3091
          have iq: "i \<le> q - Suc 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3092
            using that by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3093
          have sf_eqh: "singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3094
                           (\<lambda>x. if x \<in> standard_simplex (Suc q)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3095
                                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
  3096
                      = h (simp (q - Suc 0) i x 0,
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3097
                           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
  3098
            if x: "x \<in> standard_simplex q" for x
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3099
          proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3100
            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
  3101
                               else if Suc k = j then x j else 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3102
            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
  3103
              using ss_ss [OF iq] that ij
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3104
              by (simp add: simplical_face_in_standard_simplex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3105
            have ss: "?f \<in> standard_simplex (q - Suc 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3106
              unfolding standard_simplex_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3107
            proof (intro CollectI conjI impI allI)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3108
              fix k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3109
              show "0 \<le> ?f k"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3110
                using that by (simp add: sum_nonneg standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3111
              show "?f k \<le> 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3112
                using x sum_le_included [of "{..q}" "{..q}" x "id"]
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3113
                by (simp add: standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3114
              assume k: "q - Suc 0 < k"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3115
              show "?f k = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3116
                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
  3117
            next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3118
              have "(\<Sum>k\<le>q - Suc 0. ?f k)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3119
                  = (\<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
  3120
                apply (simp add: sum.Sigma)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3121
                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
  3122
              also have "\<dots> = sum x {..q}"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3123
                apply (rule sum.eq_general_inverses
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3124
                    [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
  3125
                      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
  3126
                using ij by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3127
              also have "\<dots> = 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3128
                using x by (simp add: standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3129
              finally show "(\<Sum>k\<le>q - Suc 0. ?f k) = 1"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3130
                by (simp add: standard_simplex_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3131
            qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3132
            let ?g = "\<lambda>k. if k \<le> i then 0
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3133
                              else if k < Suc j then x k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3134
                                   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
  3135
            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
  3136
              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
  3137
              by (force simp: image_iff)+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3138
            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
  3139
              by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3140
            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
  3141
              by (rule sum.mono_neutral_right) auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3142
            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
  3143
              by (rule sum.union_disjoint) auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3144
            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
  3145
              by (auto simp: sum.reindex)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3146
            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
  3147
                           + (\<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
  3148
              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
  3149
            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
  3150
              unfolding eq by (subst sum.union_disjoint) auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3151
            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
  3152
            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
  3153
              by (simp add: simplical_face_def cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3154
            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
  3155
                                    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
  3156
                                    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
  3157
                                    else 0)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3158
                = simplical_face j
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3159
                   (\<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
  3160
                                else if Suc k = j then x j else 0)"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3161
            proof -
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3162
              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
  3163
                    = (\<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
  3164
                (is "?lhs = ?rhs")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3165
                if "k \<noteq> q" "k > j" for k
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3166
              proof (cases "k \<le> q")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3167
                case True
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3168
                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
  3169
                  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
  3170
                then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3171
                  by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3172
              next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3173
                case False
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3174
                have "?lhs = 0" "?rhs = 0"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3175
                  by (rule sum.neutral; use False ij in auto)+
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3176
                then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3177
                  by simp
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3178
              qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3179
              show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3180
                apply (rule ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3181
                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
  3182
                apply (auto simp: sum.atMost_Suc cong: if_cong)
70095
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3183
                 apply (force simp flip: ivl_disj_un(2) intro: sum.neutral)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3184
                 apply (auto simp: *)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3185
                done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3186
            qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3187
            show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3188
              using False that iq
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3189
              unfolding oriented_simplex_def simp_def vv_def ww_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3190
              apply (simp add: if_distribR cong: if_cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3191
              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
  3192
              apply (simp add: singular_face_def fm ss QQ WW)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3193
              done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3194
          qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3195
          show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3196
            unfolding simplex_map_def restrict_def
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3197
            apply (rule ext)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3198
            apply (simp add: simplicial_simplex image_subset_iff o_def sf_eqh)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3199
            apply (simp add: singular_face_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3200
            done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3201
        qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3202
        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
  3203
          by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3204
        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
  3205
                     frag_cmul (- ((-1) ^ (i + j)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3206
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3207
                        (singular_face (Suc q) (Suc j)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3208
                          (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
  3209
                  (\<Sum>(i,j)\<in>(SIGMA i:{..q}. {i<..q}).
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3210
                     frag_cmul (- ((-1) ^ (j + i)))
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3211
                      (frag_of
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3212
                        (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
  3213
                          (simp (q - Suc 0) i))))"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3214
          by (force simp: * sgeq add.commute intro: sum.cong)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3215
        show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3216
          using False
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3217
          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
  3218
          apply (subst sum.swap [where A = "{..q}"])
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3219
          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
  3220
          done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3221
      qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3222
      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
  3223
        by (auto simp: algebra_simps)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3224
      have eq: "{..q} \<times> {..Suc q} =
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3225
                Sigma {..q} (\<lambda>i. {0..min (Suc q) i})
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3226
              \<union> Sigma {..q} (\<lambda>i. {Suc i..Suc q})"
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3227
        by force
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3228
      show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3229
        apply (subst pr_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3230
        apply (simp add: chain_boundary_sum chain_boundary_cmul)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3231
        apply (subst chain_boundary_def)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3232
        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
  3233
                     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
  3234
        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
  3235
        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
  3236
        done
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3237
    next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3238
      case (diff a b)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3239
      then show ?case
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3240
        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
  3241
    qed auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3242
  qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3243
  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
  3244
    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
  3245
  proof (cases "p")
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3246
    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
  3247
  next
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3248
    case (Suc p')
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3249
    with prism that show ?thesis by auto
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3250
  qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3251
  then show ?thesis
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3252
    using c
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3253
    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
  3254
    apply (rule_tac x="- prism p c" in exI)
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3255
    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
  3256
qed
e8f4ce87012b More homology material
paulson <lp15@cam.ac.uk>
parents: 70089
diff changeset
  3257
70086
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3258
end
72c52a897de2 First tranche of the Homology development: Simplices
paulson <lp15@cam.ac.uk>
parents:
diff changeset
  3259