Created
April 20, 2025 18:15
-
-
Save anton0xf/25f05779f997ed83f9ec3d706cd71c07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Require Import Arith. | |
| Require Import List. | |
| Import ListNotations. | |
| Check 1 :: 2 :: nil. | |
| Check [1; 2]. | |
| Fixpoint make_payrolls_rec (d a: nat) (r: list (nat * nat)) := | |
| match d with | |
| | 0 => r | |
| | S d' => make_payrolls_rec d' a ((12 - d, a) :: r) | |
| end. | |
| (* | |
| m: m0 -> 12 | |
| m = 12 - d | |
| *) | |
| Definition make_payrolls month year_amount := | |
| let remainder_amount := (13 - month) * year_amount / 12 | |
| in let month_amount := year_amount / 12 | |
| in let dec_amount := remainder_amount - (12 - month) * month_amount | |
| in (12, dec_amount) :: | |
| make_payrolls_rec (12 - month) month_amount []. | |
| Compute make_payrolls 5 20000. | |
| Import Nat. | |
| Search (_ / _ = _). | |
| Compute map fst (make_payrolls 5 2000). | |
| Compute map snd (make_payrolls 5 2000). | |
| Search (nat -> list _). | |
| Print repeat. | |
| Compute repeat 166 7. | |
| Print seq. | |
| Compute map (fun d => 12 - d) (seq 0 7). | |
| Search modulo div. | |
| Locate "_ mod _". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment