CS计算机代考程序代写 62 Simplify (no proof)

62 Simplify (no proof)
(a) §
(b) §
(c) §
0→1|1→2|2→3|3→4|4→5|[0;..5]
0→1|1→2|2→3|3→4|4→5|[0;1;2;3;4]
= 0→1|1→2|2→3|3→4|[0;1;2;3;5]
= 0→1|1→2|2→3|[0;1;2;4;5]
= 0→1|1→2|[0;1;3;4;5]
= 0→1|[0;2;3;4;5]
= [1;2;3;4;5]
= [1;..6]
(4→2 | [–3;..3]) 3
(4→2 | [–3;..3]) 3
= (4→2 | [–3; –2; –1; 0; 1; 2]) 3
= [–3; –2; –1; 0; 2; 2] 3 =0
= = = = =
((3;2)→[10;..15] | 3→[5;..10] | [0;..5]) 3 ((3;2)→[10;..15] | 3→[5;..10] | [0;..5]) 3 ((3;2)→[10;..15] | 3→[5;..10] | [0; 1; 2; 3; 4]) 3 ((3;2)→[10;..15] | [0; 1; 2; [5;..10]; 4]) 3 ((3;2)→[10;..15] | [0; 1; 2; [5; 6; 7; 8; 9]; 4]) 3 [0; 1; 2; [5; 6; [10;..15]; 8; 9]; 4] 3
[5; 6; [10;..15]; 8; 9]
(d)
§ One way:
([0;..5] [3; 4]) 1
([0;..5] [3; 4]) 1
= [[0;..5] 3; [0;..5] 4] 1
= [0;..5] 4 =4 Another way:
([0;..5] [3; 4]) 1
= [0;..5] ([3; 4] 1)
= [0;..5] 4 =4
(e) (2;2)→“j” | [[“abc”]; [“de”]; [“fghi”]]
§ Item 2 of [[“abc”]; [“de”]; [“fghi”]] is [“fghi”] and its item 2 is “h” so replacing
item 2;2 or [[“abc”]; [“de”]; [“fghi”]] with “j” gives [[“abc”]; [“de”]; [“fgji”]]
(f) #[nat]
§ 1 because “A nonempty bunch of items is also an item.” page 17
or, informally #[nat]
= #[0, 1, 2, 3, …]
= #([0], [1], [2], [3], …)
= #[0], #[1], #[2], #[3], …
= 1, 1, 1, 1, … =1

(g) §
(h) §
(i) §
(j) §
(k) §
(l) §
This is the sort of “proof” that mathematicians accept, but it’s not a formal proof because the three dots mean “guess what goes here”. Anyway, the question did not ask for proof.
#[*3]
#[*3]
= #[nil, 3, 3;3, 3;3;3, …]
= #([nil], [3], [3;3], [3;3;3], …)
= #[nil], #[3], #[3;3], #[3;3;3], …
= 0, 1, 2, 3, …
= nat
Again, an informal “proof”, but the question did not ask for proof.
[3; 4]: [3*4*int]
4*int = int; int; int; int
3*4*int = int; int; int; int; int; int; int; int; int; int; int; int [3*4*int] = [int; int; int; int; int; int; int; int; int; int; int; int]
which is all lists of 12 integers, and [3; 4] is not a list of 12 integers, so the answer is

[3; 4]: [3; int]
[3;int] isalllistsoflength 2 whoseitem 0 is 3 andwhoseitem 1 isin int. Thelist [3; 4] is one of them, so the answer is

[3, 4; 5]: [2*int]
[2*int] is all lists of length 2 whose item whose items are both in int .
[3, 4; 5]
= [3, (4; 5)]
= [3], [4; 5]
and [3] is not a list of length 2 , so the answer is

[(3, 4); 5]: [2*int]
[(3, 4); 5] = [3;5, 4;5] = [3; 5], [4; 5]
and both these lists are of length 2 and both items of each are in int so the answer is
=

[3; (4, 5); 6; (7, 8, 9)] ‘ [3; 4; (5, 6); (7, 8)] [3; (4, 5); 6; (7, 8, 9)] ‘ [3; 4; (5, 6); (7, 8)]
([3; 4; 6; 7], [3; 5; 6; 7], [3; 4; 6; 8], [3; 5; 6; 8], [3; 4; 6; 9], [3; 5; 6; 9]) ‘ ([3; 4; 5; 7], [3; 4; 6; 7], [3; 4; 5; 8], [3; 4; 6; 8])
= [3; 4; 6; 7], [3; 4; 6; 8]
= [3; 4; 6; (7, 8)]