HITs-Examples/FiniteSets/list_representation/properties.v

61 lines
1.5 KiB
Coq
Raw Normal View History

2017-09-07 15:19:48 +02:00
(** Properties of the operations on [FSetC A] *)
2017-08-02 11:40:03 +02:00
Require Import HoTT HitTactics.
2017-09-07 15:19:48 +02:00
Require Import list_representation list_representation.operations.
2017-08-02 11:40:03 +02:00
Section properties.
Context {A : Type}.
2017-09-19 17:22:15 +02:00
Definition append_nl (x: FSetC A) : x = x
:= idpath.
2017-08-02 11:40:03 +02:00
2017-08-08 15:29:50 +02:00
Lemma append_nr : forall (x: FSetC A), x = x.
2017-08-02 11:40:03 +02:00
Proof.
hinduction; try (intros; apply set_path2).
2017-09-07 15:19:48 +02:00
- reflexivity.
- intros. apply (ap (fun y => a;;y) X).
2017-08-02 11:40:03 +02:00
Defined.
2017-09-19 17:22:15 +02:00
Lemma append_assoc :
2017-08-08 15:29:50 +02:00
forall (x y z: FSetC A), x (y z) = (x y) z.
2017-08-02 11:40:03 +02:00
Proof.
2017-09-19 17:22:15 +02:00
intros x y z.
hinduction x ; try (intros ; apply path_ishprop).
- cbn.
reflexivity.
- intros.
cbn.
f_ap.
2017-08-02 11:40:03 +02:00
Defined.
Lemma append_singleton: forall (a: A) (x: FSetC A),
2017-08-08 15:29:50 +02:00
a ;; x = x (a ;; ).
2017-08-02 11:40:03 +02:00
Proof.
intro a. hinduction; try (intros; apply set_path2).
- reflexivity.
- intros b x HR. refine (_ @ _).
+ apply comm.
+ apply (ap (fun y => b ;; y) HR).
Defined.
Lemma append_comm {H: Funext}:
2017-08-08 15:29:50 +02:00
forall (x1 x2: FSetC A), x1 x2 = x2 x1.
2017-08-02 11:40:03 +02:00
Proof.
2017-08-08 15:29:50 +02:00
hinduction ; try (intros ; apply path_forall ; intro ; apply set_path2).
2017-09-07 15:19:48 +02:00
- intros.
apply (append_nr _)^.
2017-08-02 11:40:03 +02:00
- intros a x1 HR x2.
2017-09-07 15:19:48 +02:00
refine (ap (fun y => a;;y) (HR x2) @ _).
refine (append_singleton _ _ @ _).
refine ((append_assoc _ _ _)^ @ _).
refine (ap (x2 ) (append_singleton _ _)^).
2017-08-02 11:40:03 +02:00
Defined.
Lemma singleton_idem: forall (a: A),
2017-08-08 15:29:50 +02:00
{|a|} {|a|} = {|a|}.
2017-08-02 11:40:03 +02:00
Proof.
2017-08-08 15:29:50 +02:00
intro.
apply dupl.
2017-08-02 11:40:03 +02:00
Defined.
End properties.