Analysis I, Appendix A.1: Mathematical Statements

An introduction to mathematical statements. Showcases some basic tactics and Lean syntax.

2 + 2 = 4 : Prop
2 + 2 = 5 : Prop

Every well-formed statement is either true or false...

example (P:Prop) : (P=true) (P=false) := P:PropP = (true = true) P = (false = true) P:PropP ¬P; All goals completed! 🐙

.. but not both.

example (P:Prop) : ¬ ((P=true) (P=false)) := P:Prop¬(P = (true = true) P = (false = true)) All goals completed! 🐙
-- Note: `P=true` and `P=false` simplify to `P` and `¬P` respectively.

To prove that a statement is true, it suffices to show that it is not false,

example {P:Prop} (h: P false) : P = true := P:Proph:P (false = true)P = (true = true) P:Proph:P (false = true)P; All goals completed! 🐙

while to show that a statement is false, it suffices to show that it is not true.

example {P:Prop} (h: P true) : P = false := P:Proph:P (true = true)P = (false = true) P:Proph:P (true = true)¬P; All goals completed! 🐙

This statement is true, but unlikely to be very useful.

example : 2 = 2 := rfl

This statement is also true, but not very efficient.

example : 4 4 := 4 4 All goals completed! 🐙
2 + 3 * 5 : 
2 + 3 * 5 = 17 : Prop
Prime (30 + 5) : Prop
30 + 5  42 - 7 : Prop

Conjunction

example {X Y: Prop} (hX: X) (hY: Y) : X Y := X:PropY:ProphX:XhY:YX Y X:PropY:ProphX:XhY:YXX:PropY:ProphX:XhY:YY X:PropY:ProphX:XhY:YX All goals completed! 🐙 All goals completed! 🐙
example {X Y: Prop} (hXY: X Y) : X := X:PropY:ProphXY:X YX All goals completed! 🐙example {X Y: Prop} (hXY: X Y) : Y := X:PropY:ProphXY:X YY All goals completed! 🐙example {X Y: Prop} (hX: ¬ X) : ¬ (X Y) := X:PropY:ProphX:¬X¬(X Y) X:PropY:ProphX:X YX All goals completed! 🐙example {X Y: Prop} (hY: ¬ Y) : ¬ (X Y) := X:PropY:ProphY:¬Y¬(X Y) X:PropY:ProphY:X YY All goals completed! 🐙example : (2+2=4) (3+3=6) := 2 + 2 = 4 3 + 3 = 6 2 + 2 = 43 + 3 = 6 2 + 2 = 4 All goals completed! 🐙 All goals completed! 🐙

Disjunction

example {X Y: Prop} (hX: X) : X Y := X:PropY:ProphX:XX Y X:PropY:ProphX:XX All goals completed! 🐙
example {X Y: Prop} (hY: Y) : X Y := X:PropY:ProphY:YX Y X:PropY:ProphY:YY All goals completed! 🐙example {X Y: Prop} (hX: ¬ X) (hY: ¬ Y) : ¬ (X Y) := X:PropY:ProphX:¬XhY:¬Y¬(X Y) X:PropY:ProphX:¬XhY:¬Y¬X ¬Y X:PropY:ProphX:¬XhY:¬Y¬XX:PropY:ProphX:¬XhY:¬Y¬Y X:PropY:ProphX:¬XhY:¬Y¬X All goals completed! 🐙 All goals completed! 🐙example : (2+2=4) (3+3=5) := 2 + 2 = 4 3 + 3 = 5 2 + 2 = 4 All goals completed! 🐙example : ¬ ((2+2=5) (3+3=5)) := ¬(2 + 2 = 5 3 + 3 = 5) All goals completed! 🐙example : (2+2=4) (3+3=6) := 2 + 2 = 4 3 + 3 = 6 2 + 2 = 4 All goals completed! 🐙example : (2+2=4) (3+3=6) := 2 + 2 = 4 3 + 3 = 6 2 + 2 = 43 + 3 = 6 2 + 2 = 4 All goals completed! 🐙 All goals completed! 🐙example : (2+2=4) (2353 + 5931 = 7284) := 2 + 2 = 4 2353 + 5931 = 7284 2 + 2 = 4 All goals completed! 🐙
Xor' (a b : Prop) : Prop

Negation

example {X:Prop} : (¬ X = true) (X = false) := X:Prop¬X = (true = true) X = (false = true) All goals completed! 🐙
example {X:Prop} : (¬ X = false) (X = true) := X:Prop¬X = (false = true) X = (true = true) All goals completed! 🐙example : ¬ (2+2=5) := ¬2 + 2 = 5 All goals completed! 🐙example : 2+2 5 := 2 + 2 5 All goals completed! 🐙example (Jane_black_hair Jane_blue_eyes:Prop) : (¬ (Jane_black_hair Jane_blue_eyes)) (¬ Jane_black_hair ¬ Jane_blue_eyes) := Jane_black_hair:PropJane_blue_eyes:Prop¬(Jane_black_hair Jane_blue_eyes) ¬Jane_black_hair ¬Jane_blue_eyes Jane_black_hair:PropJane_blue_eyes:PropJane_black_hair ¬Jane_blue_eyes ¬Jane_black_hair ¬Jane_blue_eyes; All goals completed! 🐙example (x:) : ¬ (Even x x 0) (Odd x x < 0) := x:¬(Even x x 0) Odd x x < 0 x:this:¬Odd _fvar.17324 Even _fvar.17324 := Int.not_odd_iff_even¬(Even x x 0) Odd x x < 0 x:this✝:¬Odd _fvar.17324 Even _fvar.17324 := Int.not_odd_iff_eventhis:¬_fvar.17324 0 _fvar.17324 < 0 := Int.not_le¬(Even x x 0) Odd x x < 0 All goals completed! 🐙example (x:) : ¬ (x 2 x 6) (x < 2 x > 6) := x:¬(x 2 x 6) x < 2 x > 6 x:this:¬_fvar.29943 2 _fvar.29943 < 2 := Int.not_le¬(x 2 x 6) x < 2 x > 6 x:this✝:¬_fvar.29943 2 _fvar.29943 < 2 := Int.not_lethis:¬_fvar.29943 6 _fvar.29943 > 6 := Int.not_le¬(x 2 x 6) x < 2 x > 6 All goals completed! 🐙example (John_brown_hair John_black_hair:Prop) : (¬ (John_brown_hair John_black_hair)) (¬ John_brown_hair ¬ John_black_hair) := John_brown_hair:PropJohn_black_hair:Prop¬(John_brown_hair John_black_hair) ¬John_brown_hair ¬John_black_hair All goals completed! 🐙example (x:) : ¬ (x 1 x -1) (x < 1 x > -1) := x:¬(x 1 x -1) x < 1 x > -1 x:this:¬_fvar.46563 1 _fvar.46563 < 1 := not_le¬(x 1 x -1) x < 1 x > -1 x:this✝:¬_fvar.46563 1 _fvar.46563 < 1 := not_lethis:¬_fvar.46563 -1 _fvar.46563 > -1 := not_le¬(x 1 x -1) x < 1 x > -1 All goals completed! 🐙example (x:) : ¬ (Even x Odd x) (¬ Even x ¬ Odd x) := x:¬(Even x Odd x) ¬Even x ¬Odd x All goals completed! 🐙example (X:Prop) : ¬ (¬ X) X := X:Prop¬¬X X All goals completed! 🐙

If and only if (iff)

example {X Y: Prop} (hXY: X Y) (hX: X) : Y := X:PropY:ProphXY:X YhX:XY X:PropY:ProphXY:X YhX:YY All goals completed! 🐙
example {X Y: Prop} (hXY: X Y) (hY: Y) : X := X:PropY:ProphXY:X YhY:YX X:PropY:ProphXY:X YhY:XX All goals completed! 🐙example {X Y: Prop} (hXY: X Y) (hX: X) : Y := X:PropY:ProphXY:X YhX:XY All goals completed! 🐙example {X Y: Prop} (hXY: X Y) (hY: Y) : X := X:PropY:ProphXY:X YhY:YX All goals completed! 🐙example {X Y: Prop} (hXY: X Y) : X=Y := X:PropY:ProphXY:X YX = Y All goals completed! 🐙example (x:) : x = 3 2 * x = 6 := x:x = 3 2 * x = 6 x:x = 3 2 * x = 6x:2 * x = 6 x = 3 x:x = 3 2 * x = 6 x:h:x = 32 * x = 6 All goals completed! 🐙 x:h:2 * x = 6x = 3 All goals completed! 🐙example : ¬ ( x:, x = 3 x^2 = 9) := ¬ (x : ), x = 3 x ^ 2 = 9 x, ¬(x = 3 x ^ 2 = 9) ¬(-3 = 3 (-3) ^ 2 = 9) All goals completed! 🐙example {X Y: Prop} (hXY: X Y) (hX: ¬ X) : ¬ Y := X:PropY:ProphXY:X YhX:¬X¬Y X:PropY:ProphXY:X YhX:¬Xthis:YFalse X:PropY:ProphXY:X YhX:¬Xthis:XFalse All goals completed! 🐙example : (2+2=5) (4+4=10) := 2 + 2 = 5 4 + 4 = 10 All goals completed! 🐙example {X Y Z:Prop} (hXY: X Y) (hXZ: X Z) : [X,Y,Z].TFAE := X:PropY:PropZ:ProphXY:X YhXZ:X Z[X, Y, Z].TFAE tfae_have 1 2 := X:PropY:PropZ:ProphXY:X YhXZ:X Z[X, Y, Z].TFAE All goals completed! 🐙 -- This line is optional tfae_have 1 3 := X:PropY:PropZ:ProphXY:X YhXZ:X Z[X, Y, Z].TFAE All goals completed! 🐙 -- This line is optional All goals completed! 🐙

Note for the Invalid dotted identifier notation: The expected type of `.out` could not be determined.out method that one indexes starting from 0, in contrast to the Unknown identifier `tfae_have`tfae_have tactic.

example {X Y Z:Prop} (h: [X,Y,Z].TFAE) : X Y := X:PropY:PropZ:Proph:[X, Y, Z].TFAEX Y All goals completed! 🐙

Exercise A.1.1. Fill in the first sorry : ?m.1sorry with something reasonable.

declaration uses 'sorry'example {X Y:Prop} : ¬ ((X Y) ¬ (X Y)) sorry := X:PropY:Prop¬((X Y) ¬(X Y)) sorry All goals completed! 🐙

Exercise A.1.2. Fill in the first sorry : ?m.1sorry with something reasonable.

declaration uses 'sorry'example {X Y:Prop} : ¬ (X Y) sorry := X:PropY:Prop¬(X Y) sorry All goals completed! 🐙

Exercise A.1.3.

def declaration uses 'sorry'Exercise_A_1_3 : Decidable ( (X Y: Prop), (X Y) (¬X ¬ Y) (X Y)) := Decidable (∀ (X Y : Prop), (X Y) (¬X ¬Y) (X Y)) -- the first line of this construction should be either `apply isTrue` or `apply isFalse`, depending on whether you believe the given statement to be true or false. All goals completed! 🐙

Exercise A.1.4.

def declaration uses 'sorry'Exercise_A_1_4 : Decidable ( (X Y: Prop), (X Y) (¬Y ¬ X) (X Y)) := Decidable (∀ (X Y : Prop), (X Y) (¬Y ¬X) (X Y)) -- the first line of this construction should be either `apply isTrue` or `apply isFalse`. All goals completed! 🐙

Exercise A.1.5.

def declaration uses 'sorry'Exercise_A_1_5 : Decidable ( (X Y Z: Prop), (X Y) (Y Z) [X,Y,Z].TFAE) := Decidable (∀ (X Y Z : Prop), (X Y) (Y Z) [X, Y, Z].TFAE) -- the first line of this construction should be either `apply isTrue` or `apply isFalse`. All goals completed! 🐙

Exercise A.1.6.

def declaration uses 'sorry'Exercise_A_1_6 : Decidable ( (X Y Z: Prop), (X Y) (Y Z) (Z X) [X,Y,Z].TFAE) := Decidable (∀ (X Y Z : Prop), (X Y) (Y Z) (Z X) [X, Y, Z].TFAE) -- the first line of this construction should be either `apply isTrue` or `apply isFalse`. All goals completed! 🐙