Step
*
of Lemma
add-polynom-val
∀[n:ℕ]. ∀[p,q:polyform(n)]. ∀[l:{l:ℤ List| n ≤ ||l||} ]. (add-polynom(p;q)@l = (p@l + q@l) ∈ ℤ)
BY
{ ((Assert ⌜∀k:ℕ
∀[n:ℕ]. ∀[p,q:polyform(n)].
(((tree_size(p) + tree_size(q)) ≤ k)
⇒ (∀[l:{l:ℤ List| n ≤ ||l||} ]. (add-polynom(p;q)@l = (p@l + q@l) ∈ ℤ)))⌝⋅
THENM (Auto THEN InstHyp [⌜tree_size(p) + tree_size(q)⌝;⌜n⌝;⌜p⌝;⌜q⌝] 1⋅ THEN Auto)
)
THEN CompleteInductionOnNat
THEN Auto
THEN RecUnfold `tree_size` (-2)
THEN ((Assert p ∈ polyform(n) BY Auto) THEN FoldTop `guard` (-1) THEN RepeatFor 2 (DVar `p'))
THEN (Assert q ∈ polyform(n) BY
Auto)
THEN FoldTop `guard` (-1)
THEN RepeatFor 2 (DVar `q')
THEN All Reduce
THEN All (Unfold `guard`)
THEN RecUnfold `add-polynom` 0
THEN Reduce 0) }
1
1. k : ℕ
2. ∀k:ℕk
∀[n:ℕ]. ∀[p,q:polyform(n)].
(((tree_size(p) + tree_size(q)) ≤ k)
⇒ (∀[l:{l:ℤ List| n ≤ ||l||} ]. (add-polynom(p;q)@l = (p@l + q@l) ∈ ℤ)))
3. n : ℕ
4. p1 : ℤ
5. True
6. q1 : ℤ
7. True
8. 0 ≤ k
9. l : {l:ℤ List| n ≤ ||l||}
10. tree_leaf(p1) ∈ polyform(n)
11. tree_leaf(q1) ∈ polyform(n)
⊢ eval a = p1 + q1 in tree_leaf(a)@l = (tree_leaf(p1)@l + tree_leaf(q1)@l) ∈ ℤ
2
1. k : ℕ
2. ∀k:ℕk
∀[n:ℕ]. ∀[p,q:polyform(n)].
(((tree_size(p) + tree_size(q)) ≤ k)
⇒ (∀[l:{l:ℤ List| n ≤ ||l||} ]. (add-polynom(p;q)@l = (p@l + q@l) ∈ ℤ)))
3. n : ℕ
4. p1 : ℤ
5. True
6. left : tree(ℤ)
7. q2 : tree(ℤ)
8. ↑(((ispolyform(left) (n - 1)) ∧b (ispolyform(q2) n)) ∧b 0 <z n)
9. (0 + (1 + tree_size(left)) + tree_size(q2)) ≤ k
10. l : {l:ℤ List| n ≤ ||l||}
11. tree_leaf(p1) ∈ polyform(n)
12. tree_node(left;q2) ∈ polyform(n)
⊢ eval a = add-polynom(tree_leaf(p1);left) in
eval b = q2 in
tree_node(a;b)@l
= (tree_leaf(p1)@l + tree_node(left;q2)@l)
∈ ℤ
3
1. k : ℕ
2. ∀k:ℕk
∀[n:ℕ]. ∀[p,q:polyform(n)].
(((tree_size(p) + tree_size(q)) ≤ k)
⇒ (∀[l:{l:ℤ List| n ≤ ||l||} ]. (add-polynom(p;q)@l = (p@l + q@l) ∈ ℤ)))
3. n : ℕ
4. left : tree(ℤ)
5. p2 : tree(ℤ)
6. ↑(((ispolyform(left) (n - 1)) ∧b (ispolyform(p2) n)) ∧b 0 <z n)
7. q1 : ℤ
8. True
9. (((1 + tree_size(left)) + tree_size(p2)) + 0) ≤ k
10. l : {l:ℤ List| n ≤ ||l||}
11. tree_node(left;p2) ∈ polyform(n)
12. tree_leaf(q1) ∈ polyform(n)
⊢ eval a = add-polynom(left;tree_leaf(q1)) in
eval b = p2 in
tree_node(a;b)@l
= (tree_node(left;p2)@l + tree_leaf(q1)@l)
∈ ℤ
4
1. k : ℕ
2. ∀k:ℕk
∀[n:ℕ]. ∀[p,q:polyform(n)].
(((tree_size(p) + tree_size(q)) ≤ k)
⇒ (∀[l:{l:ℤ List| n ≤ ||l||} ]. (add-polynom(p;q)@l = (p@l + q@l) ∈ ℤ)))
3. n : ℕ
4. left : tree(ℤ)
5. p2 : tree(ℤ)
6. ↑(((ispolyform(left) (n - 1)) ∧b (ispolyform(p2) n)) ∧b 0 <z n)
7. l1 : tree(ℤ)
8. q2 : tree(ℤ)
9. ↑(((ispolyform(l1) (n - 1)) ∧b (ispolyform(q2) n)) ∧b 0 <z n)
10. (((1 + tree_size(left)) + tree_size(p2)) + (1 + tree_size(l1)) + tree_size(q2)) ≤ k
11. l : {l:ℤ List| n ≤ ||l||}
12. tree_node(left;p2) ∈ polyform(n)
13. tree_node(l1;q2) ∈ polyform(n)
⊢ eval a = add-polynom(left;l1) in
eval b = add-polynom(p2;q2) in
if poly-zero(b) ∧b poly-int(a) then a else tree_node(a;b) fi @l
= (tree_node(left;p2)@l + tree_node(l1;q2)@l)
∈ ℤ
Latex:
Latex:
\mforall{}[n:\mBbbN{}]. \mforall{}[p,q:polyform(n)]. \mforall{}[l:\{l:\mBbbZ{} List| n \mleq{} ||l||\} ]. (add-polynom(p;q)@l = (p@l + q@l))
By
Latex:
((Assert \mkleeneopen{}\mforall{}k:\mBbbN{}
\mforall{}[n:\mBbbN{}]. \mforall{}[p,q:polyform(n)].
(((tree\_size(p) + tree\_size(q)) \mleq{} k)
{}\mRightarrow{} (\mforall{}[l:\{l:\mBbbZ{} List| n \mleq{} ||l||\} ]. (add-polynom(p;q)@l = (p@l + q@l))))\mkleeneclose{}\mcdot{}
THENM (Auto THEN InstHyp [\mkleeneopen{}tree\_size(p) + tree\_size(q)\mkleeneclose{};\mkleeneopen{}n\mkleeneclose{};\mkleeneopen{}p\mkleeneclose{};\mkleeneopen{}q\mkleeneclose{}] 1\mcdot{} THEN Auto)
)
THEN CompleteInductionOnNat
THEN Auto
THEN RecUnfold `tree\_size` (-2)
THEN ((Assert p \mmember{} polyform(n) BY Auto) THEN FoldTop `guard` (-1) THEN RepeatFor 2 (DVar `p'))
THEN (Assert q \mmember{} polyform(n) BY
Auto)
THEN FoldTop `guard` (-1)
THEN RepeatFor 2 (DVar `q')
THEN All Reduce
THEN All (Unfold `guard`)
THEN RecUnfold `add-polynom` 0
THEN Reduce 0)
Home
Index