#import "@preview/cetz:0.4.0"
#import "@preview/cetz-venn:0.1.4"

#image("Opgaver 18-09-25-image.png")
#image("Opgave 2.2-27.png")
a) ${4,6}$

b) ${0,1,2,3,4,5,6,7,8,9,10}$

c) ${4,5,6,7,8,10}$

d) ${0,2,4,5,6,7,8,9,10}$

#image("opgave 2.2-29.png")
#cetz.canvas({
  cetz-venn.venn3(
    name: "venn1",
    ab-fill: blue.lighten(60%),
    stroke: black + 1pt
  )
  
  import cetz.draw: *
  content("venn1.a", [A], size: 14pt)
  content("venn1.b", [B], size: 14pt)  
  content("venn1.c", [C], size: 14pt)
  
  content((0, -3), [$A inter (B - C)$: Only the AB region (excluding ABC)], size: 12pt)
})

#cetz.canvas({
  cetz-venn.venn3(
    name: "venn2",
    ab-fill: green.lighten(60%),
    ac-fill: green.lighten(60%),
    abc-fill: green.lighten(40%),
    stroke: black + 1pt
  )
  
  import cetz.draw: *
  content("venn2.a", [A], size: 14pt)
  content("venn2.b", [B], size: 14pt)  
  content("venn2.c", [C], size: 14pt)
  
  content((0, -3), [$(A inter B) union (A inter C)$: All regions where A overlaps with B or C], size: 12pt)
})

#cetz.canvas({
  cetz-venn.venn3(
    name: "venn3",
    a-fill: orange.lighten(60%),
    ab-fill: orange.lighten(50%),
    ac-fill: orange.lighten(50%),
    abc-fill: orange.lighten(40%),
    stroke: black + 1pt
  )
  
  import cetz.draw: *
  content("venn3.a", [A], size: 14pt)
  content("venn3.b", [B], size: 14pt)  
  content("venn3.c", [C], size: 14pt)
  
  content((0, -3), [$(A union B) inter (A union C) = A union (B inter C)$ (distributive law)], size: 12pt)
})
#image("Opgave 2.2-35.png")
We can use De morgans laws, which states: $dash(A union B)= dash(A) inter dash(B)$. We use that on the 3 parentheses.
$ 
dash((A union B)) inter dash((B union C)) inter dash((A union C))<=>\
(dash(A)inter dash(B)) inter (dash(B) inter dash(C)) inter (dash(A) inter dash(C)) <=> \
"We know because of the distributive laws, that in our case, the parenthases dont matter, so:"\
dash(A) inter dash(B) inter dash(B) inter dash(C) inter dash(A) inter dash(C) <=> \
"We can remove dupplicates:"\
dash(A)inter dash(B) inter dash(C)
$
#image("Opgave 2.2-47-prerequisits.png")
#image("Opgave 2.2-47.png")
Yes. If A contained an element that B did not, it would mean $A plus.circle B$ now contains elements not in $B plus.circle C$ because A has an extra element not in C, so it is in $A plus.circle C$, but since B does not contain it, it is not in $B plus.circle C$. A and B must also contain the same elements of C, since if they did not, no matter what $A plus.circle C = B plus.circle C$ would not be true.

#image("opgave 2.3-9g.png")
$floor(1/2+ceil(3/2))<=>\ floor(1/2+2)=floor(2.5)=2$

#image("opgave 2.3-21.png")
a) $f(x)=2|x|+x$ - It will always be a positive even integer minus x.

b) $f(x)=|x|$ - All positive integers are mapped to an integer, but they are all mapped to two.

c) $underbracket(f\: ZZ arrow ZZ^+, f(x) = cases(2x "if" x > 0, -2x + 1 "if" x <= 0))$

d) $f(x)=x^2$

#image("opgave 2.3-27.png")
a) For a strictly decreasing function we know: $x>y=>f(x)>f(y) space forall x,y in A$, which means that two for two different x and y, f(x) and f(y) must be different.

b) $f(x)=cases(x "if" x>=0,-1 "if" x<=0)$

#image("opgave 2.3-73.png")
#image("opgave 2.3-73a.png")
If one of $f_(A)(x) "or" f_(B)(x)$ is 0, then $f_(A inter B)(x)$ must be 0 because of the $inter$. $f_(A)(x) dot f_(B)(x)$ must also be 0 because then you are multiplying with 0, which will always be 0.