Skip to content

Commit f524a27

Browse files
oskgostrub
authored andcommitted
reduce number of axioms in Logic
1 parent f9c77c6 commit f524a27

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

theories/prelude/Logic.ec

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,20 +648,33 @@ lemma eq_imp (y: 'a) x: x = y => x = y by done.
648648
lemma eq_sym_imp : forall (x y : 'a), x = y => y = x by [].
649649
650650
(* -------------------------------------------------------------------- *)
651-
op choiceb ['a] (P : 'a -> bool) (x0 : 'a) : 'a.
651+
op choicebd ['a] (P : 'a -> bool) : 'a.
652652

653-
axiom choicebP ['a] (P : 'a -> bool) (x0 : 'a):
653+
axiom choicebdP ['a] (P : 'a -> bool):
654+
(exists x, P x) => P (choicebd P).
655+
656+
op [opaque] choiceb ['a] (P : 'a -> bool) (x0 : 'a) : 'a =
657+
if exists x, P x then choicebd P else x0.
658+
659+
lemma choicebP ['a] (P : 'a -> bool) (x0 : 'a):
654660
(exists x, P x) => P (choiceb P x0).
661+
proof.
662+
move => ex_Px; have:= choicebdP P ex_Px.
663+
by rewrite /choiceb ex_Px.
664+
qed.
655665

656-
axiom choiceb_dfl ['a] (P : 'a -> bool) (x0 : 'a):
666+
lemma choiceb_dfl ['a] (P : 'a -> bool) (x0 : 'a):
657667
(forall x, !P x) => choiceb P x0 = x0.
668+
proof. by rewrite -negb_exists /choiceb => ->. qed.
658669
659670
lemma eq_choice ['a] (P Q : 'a -> bool) (x0 : 'a):
660671
(forall x, P x <=> Q x) => choiceb P x0 = choiceb Q x0.
661-
proof. smt(fun_ext). qed.
672+
proof. by move => eq_all; congr; apply fun_ext => x; rewrite eq_all. qed.
662673

663-
axiom choice_dfl_irrelevant ['a] (P : 'a -> bool) (x0 x1 : 'a):
674+
lemma choice_dfl_irrelevant ['a] (P : 'a -> bool) (x0 x1 : 'a):
664675
(exists x, P x) => choiceb P x0 = choiceb P x1.
676+
proof. by rewrite /choiceb => ->. qed.
677+
665678
666679
(* -------------------------------------------------------------------- *)
667680
@@ -683,9 +696,13 @@ proof. by move => inj_f @/pcansel x; smt(pinv_inv). qed.
683696
684697
685698
(* -------------------------------------------------------------------- *)
686-
axiom funchoice ['a 'b] (P : 'a -> 'b -> bool):
699+
lemma funchoice ['a 'b] (P : 'a -> 'b -> bool):
687700
(forall x, exists y, P x y)
688701
=> (exists f, forall x, P x (f x)).
702+
proof.
703+
move => existsy; exists (fun x => choicebd (P x)) => y /=.
704+
apply/(choicebdP (P y))/existsy.
705+
qed.
689706
690707
(* -------------------------------------------------------------------- *)
691708
op sempty ['a] (E : 'a -> bool) =

0 commit comments

Comments
 (0)