2014-08-24 19:58:48 -07:00
|
|
|
import logic
|
2014-07-05 22:31:57 -07:00
|
|
|
|
2015-04-21 19:33:21 -07:00
|
|
|
section
|
2014-10-09 07:13:06 -07:00
|
|
|
variable {A : Type}
|
|
|
|
variable f : A → A → A
|
|
|
|
variable one : A
|
|
|
|
variable inv : A → A
|
2015-04-21 19:33:21 -07:00
|
|
|
local infixl `*` := f
|
|
|
|
local postfix `^-1`:100 := inv
|
2014-07-05 22:31:57 -07:00
|
|
|
definition is_assoc := ∀ a b c, (a*b)*c = a*b*c
|
|
|
|
definition is_id := ∀ a, a*one = a
|
|
|
|
definition is_inv := ∀ a, a*a^-1 = one
|
|
|
|
end
|
|
|
|
|
2014-10-07 18:02:15 -07:00
|
|
|
inductive group_struct [class] (A : Type) : Type :=
|
2014-08-22 15:46:10 -07:00
|
|
|
mk_group_struct : Π (mul : A → A → A) (one : A) (inv : A → A), is_assoc mul → is_id mul one → is_inv mul one inv → group_struct A
|
2014-07-05 22:31:57 -07:00
|
|
|
|
|
|
|
inductive group : Type :=
|
2014-08-22 15:46:10 -07:00
|
|
|
mk_group : Π (A : Type), group_struct A → group
|
2014-07-05 22:31:57 -07:00
|
|
|
|
|
|
|
definition carrier (g : group) : Type
|
2014-09-04 15:03:59 -07:00
|
|
|
:= group.rec (λ c s, c) g
|
2014-07-05 22:31:57 -07:00
|
|
|
|
2014-07-06 16:46:34 -07:00
|
|
|
definition group_to_struct [instance] (g : group) : group_struct (carrier g)
|
2014-09-04 15:03:59 -07:00
|
|
|
:= group.rec (λ (A : Type) (s : group_struct A), s) g
|
2014-07-05 22:31:57 -07:00
|
|
|
|
2014-07-06 16:46:34 -07:00
|
|
|
check group_struct
|
|
|
|
|
2015-10-13 15:39:03 -07:00
|
|
|
definition mul1 {A : Type} {s : group_struct A} (a b : A) : A
|
2014-09-04 15:03:59 -07:00
|
|
|
:= group_struct.rec (λ mul one inv h1 h2 h3, mul) s a b
|
2014-07-05 22:31:57 -07:00
|
|
|
|
2015-10-13 15:39:03 -07:00
|
|
|
infixl `*` := mul1
|
2014-07-05 22:31:57 -07:00
|
|
|
|
2014-10-02 16:20:52 -07:00
|
|
|
constant G1 : group.{1}
|
|
|
|
constant G2 : group.{1}
|
|
|
|
constants a b c : (carrier G2)
|
|
|
|
constants d e : (carrier G1)
|
2014-07-05 22:31:57 -07:00
|
|
|
check a * b * b
|
|
|
|
check d * e
|