doc-src/IsarOverview/Isar/Calc.thy
author immler@in.tum.de
Wed, 25 Feb 2009 10:02:10 +0100
changeset 30150 4d5a98cebb24
parent 16417 9bc16273c2d4
permissions -rw-r--r--
removed local ref const_needs_hBOOL; renamed some const_min_arity parameters to cma
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 13999
diff changeset
     1
theory Calc imports Main begin
13999
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     2
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     3
subsection{* Chains of equalities *}
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     4
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     5
axclass
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     6
  group < zero, plus, minus
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     7
  assoc:       "(x + y) + z = x + (y + z)"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     8
  left_0:      "0 + x = x"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
     9
  left_minus:  "-x + x = 0"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    10
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    11
theorem right_minus: "x + -x = (0::'a::group)"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    12
proof -
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    13
  have   "x + -x = (-(-x) + -x) + (x + -x)"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    14
    by (simp only: left_0 left_minus)
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    15
  also have "... = -(-x) + ((-x + x) + -x)"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    16
    by (simp only: group.assoc)
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    17
  also have "... = 0"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    18
    by (simp only: left_0 left_minus)
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    19
  finally show ?thesis .
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    20
qed
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    21
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    22
subsection{* Inequalities and substitution *}
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    23
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    24
lemmas distrib = zadd_zmult_distrib zadd_zmult_distrib2
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    25
                 zdiff_zmult_distrib zdiff_zmult_distrib2
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    26
declare numeral_2_eq_2[simp]
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    27
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    28
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    29
lemma fixes a :: int shows "(a+b)\<twosuperior> \<le> 2*(a\<twosuperior> + b\<twosuperior>)"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    30
proof -
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    31
       have "(a+b)\<twosuperior> \<le> (a+b)\<twosuperior> + (a-b)\<twosuperior>"  by simp
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    32
  also have "(a+b)\<twosuperior> \<le> a\<twosuperior> + b\<twosuperior> + 2*a*b"  by(simp add:distrib)
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    33
  also have "(a-b)\<twosuperior> = a\<twosuperior> + b\<twosuperior> - 2*a*b"  by(simp add:distrib)
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    34
  finally show ?thesis by simp
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    35
qed
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    36
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    37
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    38
subsection{* More transitivity *}
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    39
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    40
lemma assumes R: "(a,b) \<in> R" "(b,c) \<in> R" "(c,d) \<in> R"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    41
      shows "(a,d) \<in> R\<^sup>*"
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    42
proof -
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    43
       have "(a,b) \<in> R\<^sup>*" ..
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    44
  also have "(b,c) \<in> R\<^sup>*" ..
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    45
  also have "(c,d) \<in> R\<^sup>*" ..
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    46
  finally show ?thesis .
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    47
qed
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    48
454a2ad0c381 IsarOverview moved one level up
kleing
parents:
diff changeset
    49
end