A Lean Companion to Conceptual Mathematics

Test 1๐Ÿ”—

Problem 1 (p. 119)

Throughout this problem

inductive A | Mara | Aurelio | Andrea deriving Fintype

(a) Find an invertible map {A \xrightarrow{f} A}, different from the identity map 1_A.

(b) Find an idempotent map {A \xrightarrow{e} A}, different from the identity map 1_A.

(c) Find another set B and two maps B \xrightarrow{s} A \xrightarrow{r} B for which {r \circ s = 1_B} and {s \circ r = e}. (In this part, e is still the map you chose in part (b).)

Solution: Problem 1

For part (a), we give a map f, and we show that f is invertible.

def f : A โŸถ A | A.Mara => A.Aurelio | A.Aurelio => A.Andrea | A.Andrea => A.Mara def finv : A โŸถ A | A.Mara => A.Andrea | A.Aurelio => A.Mara | A.Andrea => A.Aurelio example : IsIso f := { out := โŠข โˆƒ inv, inv โŠš f = ๐Ÿ™ A โˆง f โŠš inv = ๐Ÿ™ A โŠข finv โŠš f = ๐Ÿ™ A โˆง f โŠš finv = ๐Ÿ™ A โŠข finv โŠš f = ๐Ÿ™ AโŠข f โŠš finv = ๐Ÿ™ A all_goals x:AโŠข (f โŠš finv) x = ๐Ÿ™ A x โŠข (f โŠš finv) A.Mara = ๐Ÿ™ A A.MaraโŠข (f โŠš finv) A.Aurelio = ๐Ÿ™ A A.AurelioโŠข (f โŠš finv) A.Andrea = ๐Ÿ™ A A.Andrea โŠข (f โŠš finv) A.Mara = ๐Ÿ™ A A.MaraโŠข (f โŠš finv) A.Aurelio = ๐Ÿ™ A A.AurelioโŠข (f โŠš finv) A.Andrea = ๐Ÿ™ A A.Andrea All goals completed! ๐Ÿ™ }

For part (b), we give a map e, and we show that e is idempotent.

def e : A โŸถ A | A.Mara => A.Mara | A.Aurelio => A.Mara | A.Andrea => A.Mara instance : IsIdempotent e := { idem := โŠข e โŠš e = e x:AโŠข (e โŠš e) x = e x โŠข (e โŠš e) A.Mara = e A.MaraโŠข (e โŠš e) A.Aurelio = e A.AurelioโŠข (e โŠš e) A.Andrea = e A.Andrea โŠข (e โŠš e) A.Mara = e A.MaraโŠข (e โŠš e) A.Aurelio = e A.AurelioโŠข (e โŠš e) A.Andrea = e A.Andrea All goals completed! ๐Ÿ™ }

For part (c), we give a set B and maps r and s, and we show that they satisfy the required properties.

inductive B | b deriving Fintype def r : A โŸถ B | A.Mara => B.b | A.Aurelio => B.b | A.Andrea => B.b def s : B โŸถ A | B.b => A.Mara example : r โŠš s = ๐Ÿ™ B โˆง s โŠš r = e := โŠข r โŠš s = ๐Ÿ™ B โˆง s โŠš r = e โŠข r โŠš s = ๐Ÿ™ BโŠข s โŠš r = e โŠข r โŠš s = ๐Ÿ™ B โŠข r โŠš s = ๐Ÿ™ B All goals completed! ๐Ÿ™ โŠข s โŠš r = e โŠข s โŠš r = e x:AโŠข (s โŠš r) x = e x โŠข (s โŠš r) A.Mara = e A.MaraโŠข (s โŠš r) A.Aurelio = e A.AurelioโŠข (s โŠš r) A.Andrea = e A.Andrea โŠข (s โŠš r) A.Mara = e A.MaraโŠข (s โŠš r) A.Aurelio = e A.AurelioโŠข (s โŠš r) A.Andrea = e A.Andrea All goals completed! ๐Ÿ™
Problem 2 (p. 119)

\mathbb{R} is the set of all real numbers, and {\mathbb{R} \xrightarrow{f} \mathbb{R}} is the map given by the explicit formula {f(x) = 4x โ€” 7} for each input x. Show that f has an inverse map. To do this, give an explicit formula for the inverse map g, and then show that

(a) {(g \circ f)(x) = x} for each real number x, and that

(b) {(f \circ g)(x) = x} for each real number x.

Solution: Problem 2

Put {g(x) = \dfrac{x + 7}{4}}; then we have

example (f : โ„ โŸถ โ„) (hf : โˆ€ x : โ„, f x = 4 * x - 7) : โˆƒ g, โˆ€ x : โ„, (g โŠš f) x = x โˆง (f โŠš g) x = x := f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7โŠข โˆƒ g, โˆ€ (x : โ„), (g โŠš f) x = x โˆง (f โŠš g) x = x f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7โŠข โˆ€ (x : โ„), ((fun x โ†ฆ (x + 7) / 4) โŠš f) x = x โˆง (f โŠš fun x โ†ฆ (x + 7) / 4) x = x -- g f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข ((fun x โ†ฆ (x + 7) / 4) โŠš f) x = x โˆง (f โŠš fun x โ†ฆ (x + 7) / 4) x = x f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข (f x + 7) / 4 = x โˆง f ((x + 7) / 4) = x f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข (f x + 7) / 4 = xf:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข f ((x + 7) / 4) = x f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข (f x + 7) / 4 = x -- Proof of part (a) f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข (4 * x - 7 + 7) / 4 = x All goals completed! ๐Ÿ™ f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข f ((x + 7) / 4) = x -- Proof of part (b) f:โ„ โŸถ โ„hf:โˆ€ (x : โ„), f x = 4 * x - 7x:โ„โŠข 4 * ((x + 7) / 4) - 7 = x All goals completed! ๐Ÿ™