使用以下代码获得可能的解决方案
import algebra.group
import algebra.ring
open algebra
variable {A : Type}
variables [s : ring A] (a b c : A)
include s
theorem clown (a b c d e : A) :
(a + b + e) * ( c + d) = a * c + a * d + b*c + b*d +e*c+e*d :=
calc
(a + b + e) * ( c + d) = a*(c + d) + b*(c + d) + e*(c + d) : by rewrite distrib_three_right
... = a * c + a * d + b*(c+d)+e*(c+d) : by rewrite *left_distrib
... = a * c + a* d + (b*c + b*d) +e*(c+d) : by rewrite *left_distrib
... = a * c + a* d + (b*c + b*d) +(e*c+e*d): by rewrite left_distrib
... = a * c + a* d + b*c + b*d + (e*c+e*d) : !add.assoc
... = a * c + a* d + b*c + b*d + e*c+e*d : !add.assoc
check clown
其他示例
import algebra.group
import algebra.ring
open algebra
variable {A : Type}
variables [s : ring A] (a b c : A)
include s
theorem clown (a b c d e f: A) :
(a + b + e + f) * ( c + d) = a * c + a * d + b*c + b*d +e*c+e*d + f * c + f * d:=
calc
(a + b + e + f) * ( c + d) = a*(c + d) + b*(c + d) + e*(c + d) + f*(c +d) : by rewrite *right_distrib
... = a * c + a * d + b*(c+d)+e*(c+d) + f * (c + d): by rewrite *left_distrib
... = a * c + a* d + (b*c + b*d) +e*(c+d) + f*(c+d): by rewrite *left_distrib
... = a * c + a* d + (b*c + b*d) +(e*c+e*d)+ f*(c+d): by rewrite left_distrib
... = a * c + a* d + (b*c + b*d) +(e*c+e*d)+ (f*c+ f*d): by rewrite left_distrib
... = a * c + a* d + b*c + b*d + (e*c+e*d)+ (f*c+f*d) : !add.assoc
... = a * c + a* d + b*c + b*d + e*c+e*d + (f*c + f*d): !add.assoc
... = a * c + a* d + b*c + b*d + e*c+e*d + f*c + f*d : !add.assoc
check clown
同样的例子,但减少了
variable {A : Type}
variables [s : ring A]
include s
theorem clown (a b c d e f: A) :
(a + b + e + f) * ( c + d) = a * c + a * d + b*c + b*d +e*c+e*d + f * c + f * d:=
calc
(a + b + e + f) * ( c + d) = a*(c + d) + b*(c + d) + e*(c + d) + f*(c +d) : by rewrite *right_distrib
... = a * c + a* d + (b*c + b*d) +(e*c+e*d)+ (f*c+ f*d): by rewrite *left_distrib
... = a * c + a* d + b*c + b*d + e*c+e*d + f*c + f*d : by rewrite *add.assoc
check clown
其他示例
import algebra.ring
open algebra
check mul_sub_left_distrib
check add.assoc
variable {A : Type}
variables [s : ring A]
include s
theorem clown (a b c d : A) :
(a + b ) * ( c - d) = a*c-a*d+ b*c- b*d:=
calc
(a + b) * ( c -d) = a*(c-d) +b*(c-d) : by rewrite *right_distrib
... = a*(c + -d) + b*(c-d) : rfl
... = a*c + a*-d+b*(c-d) : by rewrite left_distrib
... = a*c + a*-d + (b*c - b*d): by rewrite mul_sub_left_distrib
... = a*c + a*-d + b*c - b*d : add.assoc
... = a*c + -(a*d)+ b*c - b*d : by rewrite mul_neg_eq_neg_mul_symm
... = a*c - a*d + b*c - b*d : rfl
check clown
其他示例
import algebra.group
import algebra.ring
open algebra
variable {A : Type}
variables [s : ring A]
include s
theorem clown (a b c d e : A) :
(a + b + e ) * ( c - d) = a*c -a*d + b*c - b*d + e*c - e*d:=
calc
(a + b + e) * ( c - d) = a*(c-d) +b*(c-d) + e*(c-d) : by rewrite *right_distrib
... = a*(c + -d) + b*(c+ -d) + e*(c-d): rfl
... = a*c + a*-d+(b*c +b*-d) + e*(c-d) : by rewrite *left_distrib
... = a*c + a*-d + (b*c +b*-d)+ (e*c -e*d) : by rewrite *mul_sub_left_distrib
... = a*c + a*-d + b*c + b*-d + (e*c - e*d) : !add.assoc
... = a*c + a*-d + b*c + b*-d + e*c - e*d : !add.assoc
... = a*c + -(a*d) + b*c +-(b*d) + e*c - e*d : by rewrite *mul_neg_eq_neg_mul_symm
... = a*c - a*d + b*c - b*d + e*c - e*d : rfl
check clown
其他示例
import algebra.group
import algebra.ring
open algebra
variable {A : Type}
variables [s : ring A]
include s
theorem clown (a b c d e f : A) :
(a + b + e + f) * ( c - d) = a*c -a*d + b*c - b*d + e*c - e*d + f*c - f*d:=
calc
(a + b + e + f) * ( c - d) = a*(c-d) +b*(c-d) + e*(c-d) + f*(c - d) : by rewrite *right_distrib
... = a*(c + -d) + b*(c+ -d) + e*(c + -d) + f *(c-d): rfl
... = a*c + a*-d+(b*c +b*-d) + (e*c + e*-d)+ f*(c-d) : by rewrite *left_distrib
... = a*c + a*-d + (b*c +b*-d)+ (e*c + e*-d) + (f*c - f*d) : by rewrite *mul_sub_left_distrib
... = a*c + a*-d + b*c + b*-d + (e*c + e*-d) + (f*c -f*d): !add.assoc
... = a*c + a*-d + b*c + b*-d + e*c + e*-d + (f*c - f*d): !add.assoc
... = a*c + a*-d + b*c + b*-d + e*c + e*-d + f*c - f*d: !add.assoc
... = a*c + -(a*d) + b*c +-(b*d) + e*c + - (e*d) + f*c - f*d : by rewrite *mul_neg_eq_neg_mul_symm
... = a*c - a*d + b*c - b*d + e*c - e*d + f*c - f*d : rfl
check clown
其他示例
import algebra.group
import algebra.ring
open algebra
variable {A : Type}
variables [s : ring A]
include s
theorem clown (a b c d e f : A) :
(a + b - e - f) * ( c - d) = a*c -a*d + b*c -b*d -e*c + e*d - f*c + f*d :=
calc
(a + b - e - f) * ( c - d) =(a + b + -e + -f)*(c-d) : rfl
... = a*(c-d) +b*(c-d) + -e*(c-d) + -f*(c - d) : by rewrite *right_distrib
... = a*(c + -d) + b*(c+ -d) + -e*(c + -d) + -f *(c-d): rfl
... = a*c + a*-d+(b*c +b*-d) + (-e*c + -e*-d)+ -f*(c-d) : by rewrite *left_distrib
... = a*c + a*-d + (b*c +b*-d)+ (-e*c + -e*-d) + (-f*c - -f*d) : by rewrite *mul_sub_left_distrib
... = a*c + a*-d + b*c + b*-d + (-e*c + -e*-d) + (-f*c - -f*d): !add.assoc
... = a*c + a*-d + b*c + b*-d + -e*c + -e*-d + (-f*c - -f*d): !add.assoc
... = a*c + a*-d + b*c + b*-d + -e*c + -e*-d + -f*c - -f*d: !add.assoc
... = a*c + -(a*d) + b*c +-(b*d) + -e*c + - (-e*d) + -f*c - -f*d : by rewrite *mul_neg_eq_neg_mul_symm
... = a*c - a*d + b*c -b*d + -e*c + - (-e*d) + -f*c - -f*d : rfl
... =a*c - a*d + b*c -b*d + -(e*c) + - -(e*d) + -(f*c) - -(f*d) : by rewrite *neg_mul_eq_neg_mul_symm
... =a*c - a*d + b*c -b*d - e*c + - -(e*d) - f*c - -(f*d) : rfl
... = a*c - a*d + b*c -b*d - e*c + (e*d) - f*c - -(f*d) : by rewrite neg_neg
... = a*c - a*d + b*c -b*d - e*c + e*d - f*c + - -(f*d) : rfl
... = a*c - a*d + b*c -b*d - e*c + e*d - f*c + (f*d) : by rewrite neg_neg
... = a*c - a*d + b*c -b*d - e*c + e*d - f*c + f*d : rfl
check clown