import MyNat.Definition
namespace MyNat
open MyNat
Function world.
Level 9: a big maze.
In Proposition World you will see a variant of this example which can be solved by a tactic. It would be an interesting project to make a tactic which could automatically solve this sort of level in Lean.
You can of course work both forwards and backwards, or you could crack and draw a picture.
Definition
Given a bunch of functions, we can define another one.
example (example: (A B C D E F G H I J K L : Type) → (A → B) → (B → E) → (E → D) → (D → A) → (E → F) → (F → C) → (B → C) → (F → G) → (G → J) → (I → J) → (J → I) → (I → H) → (E → H) → (H → K) → (I → L) → A → LAA: TypeBB: TypeCC: TypeDD: TypeEE: TypeFF: TypeGG: TypeHH: TypeII: TypeJJ: TypeKK: TypeL :L: TypeType) (Type: Type 1f1 :f1: A → BA →A: TypeB) (B: Typef2 :f2: B → EB →B: TypeE) (E: Type:E →E: TypeD) (D: Type:D →D: TypeA) (A: Typef5 :f5: E → FE →E: TypeF) (F: Type:F →F: TypeC) (C: Type:B →B: TypeC) (C: Typef8 :f8: F → GF →F: TypeG) (G: Typef9 :f9: G → JG →G: TypeJ) (J: Type:I →I: TypeJ) (J: Typef11 :f11: J → IJ →J: TypeI) (I: Type:I →I: TypeH) (H: Type:E →E: TypeH) (H: Type:H →H: TypeK) (K: Typef15 :f15: I → LI →I: TypeL) :L: TypeA →A: TypeL :=L: TypeA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → LA → LA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: ALA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: AIA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: AJA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: AGA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: AFA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: AEA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: ABA, B, C, D, E, F, G, H, I, J, K, L: Type
f1: A → B
f2: B → E
f3: E → D
f4: D → A
f5: E → F
f6: F → C
f7: B → C
f8: F → G
f9: G → J
f10: I → J
f11: J → I
f12: I → H
f13: E → H
f14: H → K
f15: I → L
a: AAGoals accomplished! 🐙
Here we finish this proof with a new tactic assumption
instead of exact a
.
The assumption
tactic tries to solve the goal using a
hypothesis of compatible type. Since we have the hypothesis named a
it finds
it and completes the proof.
That's the end of Function World! Next it's Proposition World, and the tactics you've learnt in Function World are enough to solve all nine levels! In fact, the levels in Proposition World might look strangely familiar...