src/Tools/isac/BaseDefinitions/BaseDefinitions.thy
author wneuper <Walther.Neuper@jku.at>
Wed, 19 Oct 2022 10:43:04 +0200
changeset 60567 bb3140a02f3d
parent 60505 137227934d2e
child 60569 f5454fd2e013
permissions -rw-r--r--
eliminate term2str in src, Prog_Tac.*_adapt_to_type
     1 (* Title:  "BaseDefinitions/BaseDefinitions.thy"
     2    Author: Walther Neuper 190823
     3    (c) due to copyright terms
     4 
     5 Know_Store holds Theory_Data (problems, methods, etc) and requires respective definitions.
     6 *)
     7 theory BaseDefinitions imports Know_Store
     8 begin
     9 
    10 subsection \<open>Power re-defined for a specific type\<close>
    11 
    12 definition even_real :: "real \<Rightarrow> bool"
    13   where "even_real x \<longleftrightarrow> \<bar>x\<bar> \<in> \<nat> \<and> even (inv real \<bar>x\<bar>)"
    14 definition odd_real :: "real \<Rightarrow> bool"
    15   where "odd_real x \<longleftrightarrow> \<bar>x\<bar> \<in> \<nat> \<and> odd (inv real \<bar>x\<bar>)"
    16 
    17 definition realpow :: "real \<Rightarrow> real \<Rightarrow> real"  (infixr "\<up>" 80)
    18   where "x \<up> n =
    19     (if x \<ge> 0 then x powr n
    20      else if n \<ge> 0 \<and> even_real n then (- x) powr n
    21      else if n \<ge> 0 \<and> odd_real n then - ((- x) powr n)
    22      else if n < 0 \<and> even_real n then 1 / (- x) powr (- n)
    23      else if n < 0 \<and> odd_real n then - 1 / ((- x) powr (- n))
    24      else undefined)"
    25 
    26 lemma realpow_simps [simp]:
    27   "0 \<up> a = 0"
    28   "1 \<up> a = 1"
    29   "numeral m \<up> numeral n = (numeral m ^ numeral n :: real)"
    30   "x > 0 \<Longrightarrow> x \<up> 0 = 1"
    31   "x \<ge> 0 \<Longrightarrow> x \<up> 1 = x"
    32   "x \<ge> 0 \<Longrightarrow> x \<up> numeral n = x ^ numeral n"
    33   "x > 0 \<Longrightarrow> x \<up> - numeral n = 1 / (x ^ numeral n)"
    34   by (simp_all add: realpow_def powr_neg_numeral)
    35 
    36 lemma inv_real_eq:
    37   "inv real 0 = 0"
    38   "inv real 1 = 1"
    39   "inv real (numeral n) = numeral n"
    40   by (simp_all add: inv_f_eq)
    41 
    42 lemma realpow_uminus_simps [simp]:
    43   "(- 1) \<up> 0 = 1"
    44   "(- 1) \<up> 1 = - 1"
    45   "x \<up> (- 1) = 1 / x"
    46   "(- numeral m) \<up> 0 = 1"
    47   "(- numeral m) \<up> 1 = - numeral m"
    48   "even (numeral n :: nat) \<Longrightarrow> (- 1) \<up> (numeral n) = 1"
    49   "odd (numeral n :: nat) \<Longrightarrow> (- 1) \<up> (numeral n) = - 1"
    50   "even (numeral n :: nat) \<Longrightarrow> (- 1) \<up> (- numeral n) = 1"
    51   "odd (numeral n :: nat) \<Longrightarrow> (- 1) \<up> (- numeral n) = - 1"
    52   "odd (numeral n :: nat) \<Longrightarrow> (- numeral m) \<up> (numeral n) = - (numeral m ^ numeral n)"
    53   "even (numeral n :: nat) \<Longrightarrow> (- numeral m) \<up> (numeral n) = numeral m ^ numeral n"
    54   "even (numeral n :: nat) \<Longrightarrow> (- numeral m) \<up> (- numeral n) = 1 / (numeral m ^ numeral n)"
    55   "odd (numeral n :: nat) \<Longrightarrow> (- numeral m) \<up> (- numeral n) = - 1 / (numeral m ^ numeral n)"
    56   apply (simp_all add: realpow_def even_real_def odd_real_def inv_real_eq)
    57   by (simp add: powr_minus_divide)
    58 
    59 ML_file termC.sml
    60 ML_file substitution.sml
    61 ML_file contextC.sml
    62 ML_file environment.sml
    63 
    64 ML \<open>
    65 \<close> ML \<open>
    66 \<close> ML \<open>
    67 \<close> ML \<open>
    68 \<close> ML \<open>
    69 \<close>
    70 end