Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
File size: 2,492 Bytes
4365a98 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
prioritize_num();;
let EGCD_INVARIANT = thm `;
!m n d. d divides egcd(m,n) <=> d divides m /\ d divides n
proof
let m n be num;
(!m'' n'.
m'' + n' < m + n
==> (!d. d divides egcd (m'',n') <=>
d divides m'' /\ d divides n'))
==> (!d. d divides egcd (m,n) <=> d divides m /\ d divides n) [1]
proof
assume !m'' n'.
m'' + n' < m + n
==> (!d. d divides egcd (m'',n') <=>
d divides m'' /\ d divides n') [2];
!d. d divides
(if m = 0
then n
else
if n = 0
then m
else if m <= n then egcd (m,n - m) else egcd (m - n,n)) <=>
d divides m /\ d divides n [3]
proof
let d be num;
m = 0 ==> (d divides n <=> d divides m /\ d divides n) [4]
by DIVIDES_0;
~(m = 0)
==> (d divides
(if n = 0
then m
else
if m <= n then egcd (m,n - m) else egcd (m - n,n)) <=>
d divides m /\ d divides n) [5]
proof
assume ~(m = 0) [6];
n = 0 ==> (d divides m <=> d divides m /\ d divides n) [7]
by DIVIDES_0;
~(n = 0)
==> (d divides
(if m <= n then egcd (m,n - m) else egcd (m - n,n)) <=>
d divides m /\ d divides n) [8]
proof
assume ~(n = 0) [9];
m <= n
==> (d divides egcd (m,n - m) <=>
d divides m /\ d divides n) [10]
proof
assume m <= n;
m + (n - m) < m + n by ARITH_TAC,6;
qed by #;
~(m <= n)
==> (d divides egcd (m - n,n) <=>
d divides m /\ d divides n) [11]
proof
assume ~(m <= n);
(m - n) + n < m + n by ARITH_TAC,9;
d divides egcd (m - n,n) <=> d divides m - n /\ d divides n
by 2;
... <=> d divides (m - n) + n /\ d divides n by DIVIDES_ADD;
:: #1
:: 1: inference error
qed by 2,DIVIDES_SUB;
:: #1
qed by COND_CASES_TAC from 10,11;
qed by COND_CASES_TAC from 7,8;
qed by COND_CASES_TAC from 4,5;
qed by ONCE_REWRITE_TAC[egcd] from 3;
qed by WF_INDUCT_TAC (parse_term "m + n") from 1;
:: #1
`;;
|