# Theory Linearform

Up to index of Isabelle/HOL/HOL-Complex/HahnBanach

theory Linearform
imports VectorSpace
begin

    (*  Title:      HOL/Real/HahnBanach/Linearform.thy
        ID:         $Id: Linearform.thy,v 1.19 2005/06/17 14:13:09 haftmann Exp $
        Author:     Gertrud Bauer, TU Munich
    *)

    header {* Linearforms *}

    theory Linearform imports VectorSpace begin

    text {*
      A \emph{linear form} is a function on a vector space into the reals
      that is additive and multiplicative.
    *}

    locale linearform = var V + var f +
      assumes add [iff]: "x ∈ V ==> y ∈ V ==> f (x + y) = f x + f y"
        and mult [iff]: "x ∈ V ==> f (a · x) = a * f x"

    declare linearform.intro [intro?]

    lemma (in linearform) neg [iff]:
      includes vectorspace
      shows "x ∈ V ==> f (- x) = - f x"
    proof -
      assume x: "x ∈ V"
      hence "f (- x) = f ((- 1) · x)" by (simp add: negate_eq1)
      also from x have "... = (- 1) * (f x)" by (rule mult)
      also from x have "... = - (f x)" by simp
      finally show ?thesis .
    qed

    lemma (in linearform) diff [iff]:
      includes vectorspace
      shows "x ∈ V ==> y ∈ V ==> f (x - y) = f x - f y"
    proof -
      assume x: "x ∈ V" and y: "y ∈ V"
      hence "x - y = x + - y" by (rule diff_eq1)
      also have "f ... = f x + f (- y)" by (rule add) (simp_all add: x y)
      also from _ y have "f (- y) = - f y" by (rule neg)
      finally show ?thesis by simp
    qed

    text {* Every linear form yields @{text 0} for the @{text 0} vector. *}

    lemma (in linearform) zero [iff]:
      includes vectorspace
      shows "f 0 = 0"
    proof -
      have "f 0 = f (0 - 0)" by simp
      also have "… = f 0 - f 0" by (rule diff) simp_all
      also have "… = 0" by simp
      finally show ?thesis .
    qed

    end

lemma neg:

      [| linearform V f; vectorspace V; x ∈ V |] ==> f (- x) = - f x

lemma diff:

      [| linearform V f; vectorspace V; x ∈ V; y ∈ V |] ==> f (x - y) = f x - f y

lemma zero:

      [| linearform V f; vectorspace V |] ==> f (0::'a) = 0