Advertisement
tinyevil

Untitled

Jan 21st, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.23 KB | None | 0 0
  1. Require Import Omega.
  2.  
  3. Theorem solve_it_for_me
  4. : forall n m q,
  5. n + m < q * 2 - m ->
  6. m < q.
  7. intros.
  8. omega.
  9. Qed.
  10.  
  11. Print solve_it_for_me.
  12. (*
  13. solve_it_for_me =
  14. fun (n m q : nat) (H : n + m < q * 2 - m) =>
  15. Decidable.dec_not_not (m < q) (dec_lt m q)
  16. (fun H0 : ~ m < q =>
  17. (fun H1 : m >= q =>
  18. (fun (P : Z -> Prop) (H2 : P (Z.of_nat n + Z.of_nat m)%Z) =>
  19. eq_ind_r P H2 (Nat2Z.inj_add n m))
  20. (fun x : Z => (x < Z.of_nat (q * 2 - m))%Z -> False)
  21. (sumbool_ind
  22. (fun _ : {m <= q * 2} + {m > q * 2} =>
  23. (Z.of_nat n + Z.of_nat m < Z.of_nat (q * 2 - m))%Z -> False)
  24. (fun Omega0 : m <= q * 2 =>
  25. (fun (P : Z -> Prop) (H2 : P (Z.of_nat (q * 2) - Z.of_nat m)%Z) =>
  26. eq_ind_r P H2 (Nat2Z.inj_sub (q * 2) m Omega0))
  27. (fun x : Z => (Z.of_nat n + Z.of_nat m < x)%Z -> False)
  28. ((fun (P : Z -> Prop) (H2 : P (Z.of_nat q * Z.of_nat 2)%Z) =>
  29. eq_ind_r P H2 (Nat2Z.inj_mul q 2))
  30. (fun x : Z =>
  31. (Z.of_nat m <= x)%Z ->
  32. (Z.of_nat n + Z.of_nat m < Z.of_nat (q * 2) - Z.of_nat m)%Z ->
  33. False)
  34. (fun _ : (Z.of_nat m <= Z.of_nat q * 2)%Z =>
  35. (fun (P : Z -> Prop) (H2 : P (Z.of_nat q * Z.of_nat 2)%Z) =>
  36. eq_ind_r P H2 (Nat2Z.inj_mul q 2))
  37. (fun x : Z =>
  38. (Z.of_nat n + Z.of_nat m < x - Z.of_nat m)%Z -> False)
  39. (fun
  40. H2 : (Z.of_nat n + Z.of_nat m <
  41. Z.of_nat q * 2 - Z.of_nat m)%Z =>
  42. (fun H3 : (Z.of_nat m >= Z.of_nat q)%Z =>
  43. ex_ind
  44. (fun (Zvar0 : Z)
  45. (Omega9 : Z.of_nat m = Zvar0 /\
  46. (0 <= Zvar0 * 1 + 0)%Z) =>
  47. and_ind
  48. (fun (Omega2 : Z.of_nat m = Zvar0)
  49. (_ : (0 <= Zvar0 * 1 + 0)%Z) =>
  50. ex_ind
  51. (fun (Zvar1 : Z)
  52. (Omega8 : Z.of_nat q = Zvar1 /\
  53. (0 <= Zvar1 * 1 + 0)%Z) =>
  54. and_ind
  55. (fun (Omega3 : Z.of_nat q = Zvar1)
  56. (_ : (0 <= Zvar1 * 1 + 0)%Z) =>
  57. ex_ind
  58. (fun (Zvar2 : Z)
  59. (Omega7 : Z.of_nat n = Zvar2 /\
  60. (0 <= Zvar2 * 1 + 0)%Z) =>
  61. and_ind
  62. (fun (Omega4 : Z.of_nat n = Zvar2)
  63. (Omega12 : (0 <= Zvar2 * 1 + 0)%Z) =>
  64. (fun (P : Z -> Prop) (H4 : P Zvar1) =>
  65. eq_ind_r P H4 Omega3)
  66. (fun x : Z =>
  67. (0 <=
  68. x * 2 + - Z.of_nat m + -1 +
  69. - (Z.of_nat n + Z.of_nat m))%Z ->
  70. False)
  71. ((fun (P : Z -> Prop) (H4 : P Zvar0)
  72. => eq_ind_r P H4 Omega2)
  73. (fun x : Z =>
  74. (0 <=
  75. Zvar1 * 2 + - x + -1 +
  76. - (Z.of_nat n + Z.of_nat m))%Z ->
  77. False)
  78. (fast_Zopp_eq_mult_neg_1 Zvar0
  79. (fun x : Z =>
  80. (0 <=
  81. Zvar1 * 2 + x + -1 +
  82. - (Z.of_nat n + Z.of_nat m))%Z ->
  83. False)
  84. (fast_Zplus_comm (Zvar1 * 2)
  85. (Zvar0 * -1)
  86. (fun x : Z =>
  87. (0 <=
  88. x + -1 +
  89. -
  90. (Z.of_nat n + Z.of_nat m))%Z ->
  91. False)
  92. (fast_Zplus_assoc_reverse
  93. (Zvar0 * -1) (Zvar1 * 2)
  94. (-1)
  95. (fun x : Z =>
  96. (0 <=
  97. x +
  98. -
  99. (Z.of_nat n +
  100. Z.of_nat m))%Z ->
  101. False)
  102. ((fun (P : Z -> Prop)
  103. (H4 : P Zvar2) =>
  104. eq_ind_r P H4 Omega4)
  105. (fun x : Z =>
  106. (0 <=
  107. Zvar0 * -1 +
  108. (Zvar1 * 2 + -1) +
  109. - (x + Z.of_nat m))%Z ->
  110. False)
  111. ((fun (P : Z -> Prop)
  112. (H4 : P Zvar0) =>
  113. eq_ind_r P H4 Omega2)
  114. (fun x : Z =>
  115. (0 <=
  116. Zvar0 * -1 +
  117. (Zvar1 * 2 + -1) +
  118. - (Zvar2 + x))%Z ->
  119. False)
  120. (fast_Zopp_plus_distr
  121. Zvar2 Zvar0
  122. (fun x : Z =>
  123. (0 <=
  124. Zvar0 * -1 +
  125. (Zvar1 * 2 +
  126. -1) + x)%Z ->
  127. False)
  128. (fast_Zopp_eq_mult_neg_1
  129. Zvar2
  130. (fun x : Z =>
  131. (0 <=
  132. Zvar0 * -1 +
  133. (Zvar1 * 2 +
  134. -1) +
  135. (x +
  136. - Zvar0))%Z ->
  137. False)
  138. (fast_Zopp_eq_mult_neg_1
  139. Zvar0
  140. (fun x : Z
  141. =>
  142. (0 <=
  143. Zvar0 *
  144. -1 +
  145. (Zvar1 *
  146. 2 + -1) +
  147. (Zvar2 *
  148. -1 + x))%Z ->
  149. False)
  150. (fast_Zplus_permute
  151. (Zvar0 *
  152. -1 +
  153. (Zvar1 *
  154. 2 + -1))
  155. (Zvar2 *
  156. -1)
  157. (Zvar0 *
  158. -1)
  159. (fun
  160. x : Z =>
  161. (0 <= x)%Z ->
  162. False)
  163. (fast_Zplus_comm
  164. (Zvar0 *
  165. -1 +
  166. (Zvar1 *
  167. 2 + -1))
  168. (Zvar0 *
  169. -1)
  170. (fun
  171. x : Z =>
  172. (0 <=
  173. Zvar2 *
  174. -1 + x)%Z ->
  175. False)
  176. (fast_Zplus_assoc
  177. (Zvar0 *
  178. -1)
  179. (Zvar0 *
  180. -1)
  181. (Zvar1 *
  182. 2 + -1)
  183. (fun
  184. x : Z =>
  185. (0 <=
  186. Zvar2 *
  187. -1 + x)%Z ->
  188. False)
  189. (fast_Zred_factor4
  190. Zvar0
  191. (-1)
  192. (-1)
  193. (fun
  194. x : Z =>
  195. (0 <=
  196. Zvar2 *
  197. -1 +
  198. (x +
  199. (Zvar1 *
  200. 2 + -1)))%Z ->
  201. False)
  202. (fun
  203. Omega5 :
  204. (0 <=
  205. Zvar2 *
  206. -1 +
  207. (Zvar0 *
  208. -2 +
  209. (Zvar1 *
  210. 2 + -1)))%Z
  211. =>
  212. (fun
  213. (P :
  214. Z -> Prop)
  215. (H4 :
  216. P Zvar0)
  217. =>
  218. eq_ind_r
  219. P H4
  220. Omega2)
  221. (fun
  222. x : Z =>
  223. (0 <=
  224. x +
  225. -
  226. Z.of_nat
  227. q)%Z ->
  228. False)
  229. ((fun
  230. (P :
  231. Z -> Prop)
  232. (H4 :
  233. P Zvar1)
  234. =>
  235. eq_ind_r
  236. P H4
  237. Omega3)
  238. (fun
  239. x : Z =>
  240. (0 <=
  241. Zvar0 +
  242. - x)%Z ->
  243. False)
  244. (fast_Zopp_eq_mult_neg_1
  245. Zvar1
  246. (fun
  247. x : Z =>
  248. (0 <=
  249. Zvar0 + x)%Z ->
  250. False)
  251. (fast_Zred_factor0
  252. Zvar0
  253. (fun
  254. x : Z =>
  255. (0 <=
  256. x +
  257. Zvar1 *
  258. -1)%Z ->
  259. False)
  260. (fast_Zred_factor6
  261. (Zvar1 *
  262. -1)
  263. (fun
  264. x : Z =>
  265. (0 <=
  266. Zvar0 * 1 +
  267. x)%Z ->
  268. False)
  269. (fun
  270. Omega6 :
  271. (0 <=
  272. Zvar0 * 1 +
  273. (Zvar1 *
  274. -1 + 0))%Z
  275. =>
  276. let H4 :=
  277. eq_refl
  278. :
  279. (1 > 0)%Z
  280. in
  281. (let
  282. H5 :=
  283. eq_refl
  284. :
  285. (1 > 0)%Z
  286. in
  287. (fun
  288. auxiliary_2
  289. auxiliary_1 :
  290. (1 > 0)%Z
  291. =>
  292. fast_OMEGA10
  293. Zvar2 1
  294. (-1) 0
  295. (Zvar0 *
  296. -2 +
  297. (Zvar1 *
  298. 2 + -1))
  299. 1 1
  300. (fun
  301. x : Z =>
  302. (0 <= x)%Z ->
  303. False)
  304. (fast_Zred_factor5
  305. Zvar2
  306. (0 +
  307. (Zvar0 *
  308. -2 +
  309. (Zvar1 *
  310. 2 + -1)) *
  311. 1)
  312. (fun
  313. x : Z =>
  314. (0 <= x)%Z ->
  315. False)
  316. (fast_OMEGA12
  317. Zvar0
  318. (-2) 0
  319. (Zvar1 *
  320. 2 + -1) 1
  321. (fun
  322. x : Z =>
  323. (0 <= x)%Z ->
  324. False)
  325. (fast_OMEGA12
  326. Zvar1 2 0
  327. (-1) 1
  328. (fun
  329. x : Z =>
  330. (0 <=
  331. Zvar0 *
  332. (-2 * 1) +
  333. x)%Z ->
  334. False)
  335. (fun
  336. Omega13 :
  337. (0 <=
  338. Zvar0 *
  339. -2 +
  340. (Zvar1 *
  341. 2 + -1))%Z
  342. =>
  343. let H6 :=
  344. fast_OMEGA11
  345. Zvar0
  346. (-1)
  347. (Zvar1 *
  348. 1 + -1) 1
  349. 2
  350. (fun
  351. x : Z =>
  352. (Zvar0 *
  353. -2 +
  354. (Zvar1 *
  355. 2 + -1))%Z =
  356. x)
  357. (fast_OMEGA11
  358. Zvar1 1
  359. (-1) 1 2
  360. (fun
  361. x : Z =>
  362. (Zvar0 *
  363. -2 +
  364. (Zvar1 *
  365. 2 + -1))%Z =
  366. (Zvar0 *
  367. (-1 * 2) +
  368. x)%Z)
  369. eq_refl)
  370. :
  371. (Zvar0 *
  372. -2 +
  373. (Zvar1 *
  374. 2 + -1))%Z =
  375. ((Zvar0 *
  376. -1 +
  377. (Zvar1 *
  378. 1 + -1)) *
  379. 2 + 1)%Z
  380. in
  381. (fun
  382. auxiliary :
  383. (Zvar0 *
  384. -2 +
  385. (Zvar1 *
  386. 2 + -1))%Z =
  387. ((Zvar0 *
  388. -1 +
  389. (Zvar1 *
  390. 1 + -1)) *
  391. 2 + 1)%Z
  392. =>
  393. (fun
  394. Omega14 :
  395. (0 <=
  396. (Zvar0 *
  397. -1 +
  398. (Zvar1 *
  399. 1 + -1)) *
  400. 2 + 1)%Z
  401. =>
  402. let H7 :=
  403. eq_refl
  404. :
  405. (2 > 1)%Z
  406. in
  407. (let
  408. H8 :=
  409. eq_refl
  410. :
  411. (2 > 0)%Z
  412. in
  413. (fun
  414. (auxiliary_3 :
  415. (2 > 0)%Z)
  416. (auxiliary_4 :
  417. (2 > 1)%Z)
  418. =>
  419. (fun
  420. Omega15 :
  421. (0 <=
  422. Zvar0 *
  423. -1 +
  424. (Zvar1 *
  425. 1 + -1))%Z
  426. =>
  427. fast_OMEGA13
  428. Zvar0
  429. (Zvar1 *
  430. -1 + 0)
  431. (Zvar1 *
  432. 1 + -1) 1
  433. (fun
  434. x : Z =>
  435. (0 <= x)%Z ->
  436. False)
  437. (fast_OMEGA14
  438. Zvar1 0
  439. (-1) 1
  440. (fun
  441. x : Z =>
  442. (0 <= x)%Z ->
  443. False)
  444. (fun
  445. H9 :
  446. Gt <> Gt
  447. =>
  448. False_ind
  449. False
  450. (H9
  451. eq_refl)))
  452. (OMEGA2
  453. (Zvar0 *
  454. 1 +
  455. (Zvar1 *
  456. -1 + 0))
  457. (Zvar0 *
  458. -1 +
  459. (Zvar1 *
  460. 1 + -1))
  461. Omega6
  462. Omega15))
  463. (Zmult_le_approx
  464. 2
  465. (Zvar0 *
  466. -1 +
  467. (Zvar1 *
  468. 1 + -1))
  469. 1
  470. auxiliary_3
  471. auxiliary_4
  472. Omega14))
  473. H8) H7)
  474. (OMEGA1
  475. (Zvar0 *
  476. -2 +
  477. (Zvar1 *
  478. 2 + -1))
  479. ((Zvar0 *
  480. -1 +
  481. (Zvar1 *
  482. 1 + -1)) *
  483. 2 + 1)
  484. auxiliary
  485. Omega13))
  486. H6))))
  487. (OMEGA7
  488. (Zvar2 *
  489. 1 + 0)
  490. (Zvar2 *
  491. -1 +
  492. (Zvar0 *
  493. -2 +
  494. (Zvar1 *
  495. 2 + -1)))
  496. 1 1
  497. auxiliary_1
  498. auxiliary_2
  499. Omega12
  500. Omega5))
  501. H5) H4)))))
  502. (Zge_left
  503. (Z.of_nat
  504. m)
  505. (Z.of_nat
  506. q) H3)))))))))))))))
  507. (Zlt_left (Z.of_nat n + Z.of_nat m)
  508. (Z.of_nat q * 2 - Z.of_nat m) H2))
  509. Omega7) (intro_Z n)) Omega8) (intro_Z q))
  510. Omega9) (intro_Z m)) (inj_ge m q H1)))
  511. (inj_le m (q * 2) Omega0)))
  512. (fun Omega0 : m > q * 2 =>
  513. (fun (P : Z -> Prop) (H2 : P 0%Z) =>
  514. eq_ind_r P H2 (inj_minus2 (q * 2) m Omega0))
  515. (fun x : Z => (Z.of_nat n + Z.of_nat m < x)%Z -> False)
  516. ((fun (P : Z -> Prop) (H2 : P (Z.of_nat q * Z.of_nat 2)%Z) =>
  517. eq_ind_r P H2 (Nat2Z.inj_mul q 2))
  518. (fun x : Z =>
  519. (Z.of_nat m > x)%Z ->
  520. (Z.of_nat n + Z.of_nat m < 0)%Z -> False)
  521. (fun (_ : (Z.of_nat m > Z.of_nat q * 2)%Z)
  522. (H2 : (Z.of_nat n + Z.of_nat m < 0)%Z) =>
  523. (fun _ : (Z.of_nat m >= Z.of_nat q)%Z =>
  524. ex_ind
  525. (fun (Zvar3 : Z)
  526. (Omega20 : Z.of_nat m = Zvar3 /\ (0 <= Zvar3 * 1 + 0)%Z)
  527. =>
  528. and_ind
  529. (fun (Omega12 : Z.of_nat m = Zvar3)
  530. (Omega21 : (0 <= Zvar3 * 1 + 0)%Z) =>
  531. ex_ind
  532. (fun (Zvar4 : Z)
  533. (Omega19 : Z.of_nat q = Zvar4 /\
  534. (0 <= Zvar4 * 1 + 0)%Z) =>
  535. and_ind
  536. (fun (_ : Z.of_nat q = Zvar4)
  537. (_ : (0 <= Zvar4 * 1 + 0)%Z) =>
  538. ex_ind
  539. (fun (Zvar5 : Z)
  540. (Omega18 : Z.of_nat n = Zvar5 /\
  541. (0 <= Zvar5 * 1 + 0)%Z) =>
  542. and_ind
  543. (fun (Omega15 : Z.of_nat n = Zvar5)
  544. (Omega23 : (0 <= Zvar5 * 1 + 0)%Z) =>
  545. (fun (P : Z -> Prop) (H4 : P Zvar5) =>
  546. eq_ind_r P H4 Omega15)
  547. (fun x : Z =>
  548. (0 <= -1 + - (x + Z.of_nat m))%Z ->
  549. False)
  550. ((fun (P : Z -> Prop) (H4 : P Zvar3) =>
  551. eq_ind_r P H4 Omega12)
  552. (fun x : Z =>
  553. (0 <= -1 + - (Zvar5 + x))%Z -> False)
  554. (fast_Zopp_plus_distr Zvar5 Zvar3
  555. (fun x : Z =>
  556. (0 <= -1 + x)%Z -> False)
  557. (fast_Zopp_eq_mult_neg_1 Zvar5
  558. (fun x : Z =>
  559. (0 <= -1 + (x + - Zvar3))%Z ->
  560. False)
  561. (fast_Zopp_eq_mult_neg_1 Zvar3
  562. (fun x : Z =>
  563. (0 <= -1 + (Zvar5 * -1 + x))%Z ->
  564. False)
  565. (fast_Zplus_permute
  566. (-1) (Zvar5 * -1)
  567. (Zvar3 * -1)
  568. (fun x : Z =>
  569. (0 <= x)%Z -> False)
  570. (fast_Zplus_comm
  571. (-1) (Zvar3 * -1)
  572. (fun x : Z =>
  573. (0 <= Zvar5 * -1 + x)%Z ->
  574. False)
  575. (fun
  576. Omega16 : (0 <=
  577. Zvar5 *
  578. -1 +
  579. (Zvar3 *
  580. -1 + -1))%Z
  581. =>
  582. let H4 :=
  583. eq_refl : (1 > 0)%Z
  584. in
  585. (let H5 :=
  586. eq_refl
  587. :
  588. (1 > 0)%Z in
  589. (fun
  590. auxiliary_2
  591. auxiliary_1 :
  592. (1 > 0)%Z =>
  593. fast_OMEGA12 Zvar5
  594. (-1)
  595. ((Zvar3 * 1 + 0) *
  596. 1)
  597. (Zvar3 * -1 + -1)
  598. 1
  599. (fun x : Z =>
  600. (0 <= x)%Z ->
  601. False)
  602. (fast_OMEGA10
  603. Zvar3 1
  604. (-1) 0
  605. (-1) 1 1
  606. (fun x : Z =>
  607. (0 <=
  608. Zvar5 *
  609. (-1 * 1) + x)%Z ->
  610. False)
  611. (fast_Zred_factor5
  612. Zvar3
  613. (0 + -1 * 1)
  614. (fun x : Z
  615. =>
  616. (0 <=
  617. Zvar5 *
  618. (-1 * 1) +
  619. x)%Z ->
  620. False)
  621. (fun
  622. Omega24 :
  623. (0 <=
  624. Zvar5 *
  625. -1 + -1)%Z
  626. =>
  627. fast_OMEGA13
  628. Zvar5 0
  629. (-1) 1
  630. (fun
  631. x : Z =>
  632. (0 <= x)%Z ->
  633. False)
  634. (fun
  635. H6 :
  636. Gt <> Gt
  637. =>
  638. False_ind
  639. False
  640. (H6
  641. eq_refl))
  642. (OMEGA2
  643. (Zvar5 *
  644. 1 + 0)
  645. (Zvar5 *
  646. -1 + -1)
  647. Omega23
  648. Omega24))))
  649. (OMEGA7
  650. (Zvar3 * 1 + 0)
  651. (Zvar5 * -1 +
  652. (Zvar3 * -1 +
  653. -1)) 1 1
  654. auxiliary_1
  655. auxiliary_2
  656. Omega21
  657. Omega16)) H5)
  658. H4)))))))
  659. (Zlt_left (Z.of_nat n + Z.of_nat m) 0 H2))
  660. Omega18) (intro_Z n)) Omega19) (intro_Z q))
  661. Omega20) (intro_Z m)) (inj_ge m q H1))
  662. (inj_gt m (q * 2) Omega0))) (le_gt_dec m (q * 2)))
  663. (inj_lt (n + m) (q * 2 - m) H)) (not_lt m q H0))
  664. : forall n m q : nat, n + m < q * 2 - m -> m < q
  665.  
  666. Argument scopes are [nat_scope nat_scope nat_scope _]
  667.  
  668. *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement