(* *)
(**************************************************************************)
-set "baseuri" "cic:/matita/demo/power_derivative".
-
include "nat/plus.ma".
include "nat/orders.ma".
include "nat/compare.ma".
interpretation "Rplus" 'plus x y =
(cic:/matita/demo/power_derivative/Rplus.con x y).
-notation "hvbox(a break \middot b)"
- left associative with precedence 55
-for @{ 'times $a $b }.
-
-interpretation "Rmult" 'times x y =
+interpretation "Rmult" 'middot x y =
(cic:/matita/demo/power_derivative/Rmult.con x y).
definition Fplus ≝
interpretation "Fplus" 'plus x y =
(cic:/matita/demo/power_derivative/Fplus.con x y).
-interpretation "Fmult" 'times x y =
+interpretation "Fmult" 'middot x y =
(cic:/matita/demo/power_derivative/Fmult.con x y).
notation "2" with precedence 89
]
].
-coercion cic:/matita/demo/power_derivative/inj.con.
+coercion inj.
axiom Rplus_Rzero_x: ∀x:R.0+x=x.
axiom Rplus_comm: symmetric ? Rplus.
axiom Rplus_assoc: associative ? Rplus.
-axiom Rmult_Rone_x: ∀x:R.1*x=x.
-axiom Rmult_Rzero_x: ∀x:R.0*x=0.
+axiom Rmult_Rone_x: ∀x:R.1 · x=x.
+axiom Rmult_Rzero_x: ∀x:R.0 · x=0.
axiom Rmult_assoc: associative ? Rmult.
axiom Rmult_comm: symmetric ? Rmult.
axiom Rmult_Rplus_distr: distributive ? Rmult Rplus.
-alias symbol "times" = "Rmult".
+alias symbol "middot" = "Rmult".
alias symbol "plus" = "natural plus".
definition monomio ≝
definition costante : nat → R → R ≝
λa:nat.λx:R.inj a.
-coercion cic:/matita/demo/power_derivative/costante.con 1.
+coercion costante with 1.
axiom f_eq_extensional:
∀f,g:R→R.(∀x:R.f x = g x) → f=g.
axiom derivative_x1: D[x] = 1.
axiom derivative_mult: ∀f,g:R→R. D[f·g] = D[f]·g + f·D[g].
-alias symbol "times" = "Fmult".
+alias symbol "middot" = "Fmult".
theorem derivative_power: ∀n:nat. D[x \sup n] = n·x \sup (pred n).
assume n:nat.
elim n 0.
case O.
the thesis becomes (D[x \sup 0] = 0·x \sup (pred 0)).
- by _
done.
case S (m:nat).
by induction hypothesis we know
(D[x \sup (1+m)] = (1+m) · x \sup m).
we need to prove
(m · (x \sup (1+ pred m)) = m · x \sup m) (Ppred).
- by _ we proved (0 < m ∨ 0=m) (cases).
+ we proved (0 < m ∨ 0=m) (cases).
we proceed by induction on cases
to prove (m · (x \sup (1+ pred m)) = m · x \sup m).
case left.
suppose (0 < m) (m_pos).
- by (S_pred m m_pos) we proved (m = 1 + pred m) (H1).
- by _
- done.
+ using (S_pred ? m_pos) we proved (m = 1 + pred m) (H1).
+ by H1 done.
case right.
- suppose (0=m) (m_zero). by _ done.
+ suppose (0=m) (m_zero).
+ by m_zero, Fmult_zero_f done.
conclude
(D[x \sup (1+m)])
= (D[x · x \sup m]).
= (D[x] · x \sup m + x · D[x \sup m]).
- = (x \sup m + x · (m · x \sup (pred m))).
+ = (x \sup m + x · (m · x \sup (pred m))) timeout=30.
= (x \sup m + m · (x \sup (1 + pred m))).
= (x \sup m + m · x \sup m).
- = ((1+m) · x \sup m) by Fmult_one_f Fmult_commutative Fmult_Fplus_distr costante_sum
+ = ((1+m) · x \sup m) timeout=30 by Fmult_one_f, Fmult_commutative, Fmult_Fplus_distr, costante_sum
done.
qed.
(cic:/matita/demo/power_derivative/derivative.con f).
*)
-notation "hvbox(\frac 'd' ('d' 'x') break p)"
- right associative with precedence 90
+notation "hvbox(\frac 'd' ('d' 'x') break p)" with precedence 90
for @{ 'derivative $p}.
interpretation "Rderivative" 'derivative f =
(D[x \sup (1+n)] = (1+n) · x \sup n).*) elim n 0.
case O.
the thesis becomes (D[x \sup 1] = 1 · x \sup 0).
- by _
done.
case S (m:nat).
by induction hypothesis we know
= (D[x] · x \sup (1+m) + x · D[x \sup (1+m)]).
= (x \sup (1+m) + x · (costante (1+m) · x \sup m)).
= (x \sup (1+m) + costante (1+m) · x \sup (1+m)).
-
-
-
- conclude (x \sup (1+m) + costante (1+m) · x \sup (1+m))
- = (costante 1 · x \sup (1+m) + costante (1+m) ·(x) \sup (1+m)) proof.
- by (Fmult_one_f ((x)\sup(1+m)))
- we proved (costante 1·(x)\sup(1+m)=(x)\sup(1+m)) (previous).
- by (eq_OF_eq ? ? (λfoo:(R→R).foo+costante (1+m)·(x)\sup(1+m)) (costante 1
- ·(x)\sup(1
- +m)) ((x)\sup(1
- +m)) previous)
- done.
- = ((x)\sup(1+m)·costante 1+costante (1+m)·(x)\sup(1+m)) proof.
- by (Fmult_commutative (costante 1) ((x)\sup(1+m)))
- we proved (costante 1·(x)\sup(1+m)=(x)\sup(1+m)·costante 1) (previous).
- by (eq_f ? ? (λfoo:(R→R).foo+costante (1+m)·(x)\sup(1+m)) (costante 1
- ·(x)\sup(1+m)) ((x)\sup(1
- +m)
- ·costante
- 1) previous)
- done.
- = ((x)\sup(1+m)·costante 1+(x)\sup(1+m)·costante (1+m)) proof.
- by (Fmult_commutative ((x)\sup(1+m)) (costante (1+m)))
- we proved ((x)\sup(1+m)·costante (1+m)=costante (1+m)·(x)\sup(1+m))
-
- (previous)
- .
- by (eq_OF_eq ? ? (λfoo:(R→R).(x)\sup(1+m)·costante 1+foo) ((x)\sup(1+m)
- ·costante
- (1+m)) (costante
- (1
- +m)
- ·(x)\sup(1
- +m)) previous)
- done.
- = ((x)\sup(1+m)·(costante 1+costante (1+m))) proof.
- by (Fmult_Fplus_distr ((x)\sup(1+m)) (costante 1) (costante (1+m)))
- we proved
- ((x)\sup(1+m)·(costante 1+costante (1+m))
- =(x)\sup(1+m)·costante 1+(x)\sup(1+m)·costante (1+m))
-
- (previous)
- .
- by (sym_eq ? ((x)\sup(1+m)·(costante 1+costante (1+m))) ((x)\sup(1+m)
- ·costante 1
- +(x)\sup(1+m)
- ·costante (1+m)) previous)
- done.
- = ((costante 1+costante (1+m))·(x)\sup(1+m))
- exact (Fmult_commutative ((x)\sup(1+m)) (costante 1+costante (1+m))).
- = (costante (1+(1+m))·(x)\sup(1+m)) proof.
- by (costante_sum 1 (1+m))
- we proved (costante 1+costante (1+m)=costante (1+(1+m))) (previous).
- by (eq_f ? ? (λfoo:(R→R).foo·(x)\sup(1+m)) (costante 1+costante (1+m)) (costante
- (1
- +(1
- +m))) previous)
- done.
- = (costante (1+1+m)·(x)\sup(1+m)) proof.
- by (assoc_plus 1 1 m)
- we proved (1+1+m=1+(1+m)) (previous).
- by (eq_OF_eq ? ? (λfoo:nat.costante foo·(x)\sup(1+m)) ? ? previous)
- done.
- = (costante (2+m)·(x)\sup(1+m)) proof done.
- by (plus_n_SO 1)
- we proved (2=1+1) (previous).
- by (eq_OF_eq ? ? (λfoo:nat.costante (foo+m)·(x)\sup(1+m)) ? ? previous)
- done.
-
-
-(* end auto($Revision: 8206 $) proof: TIME=0.06 SIZE=100 DEPTH=100 *) done.
+ = ((2+m) · x \sup (1+m)) timeout=30 by Fmult_one_f, Fmult_commutative,
+ Fmult_Fplus_distr, assoc_plus, plus_n_SO, costante_sum
+ done.
qed.