Skip to content

Commit 3d7137b

Browse files
namasikanamstrub
authored andcommitted
Logic: new lemmas: contra_congr, case_elim, iff_trans
1 parent e3e0452 commit 3d7137b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

theories/prelude/Logic.ec

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(* Run easycrypt via the commandline with a `-boot` flag instead *)
33

44
(* -------------------------------------------------------------------- *)
5-
require import Tactics.
5+
require import Tactics Pervasive.
66

77
(* -------------------------------------------------------------------- *)
88
abbrev [-printing] fst (p : 'a * 'b): 'a = p.`1.
@@ -365,12 +365,22 @@ lemma contraNneq (b : bool) (x y : 'a):
365365
(x = y => b) => !b => x <> y
366366
by smt().
367367
368+
lemma contra_congr ['a 'b] (f : 'a -> 'b) (x y : 'a) :
369+
f x <> f y => x <> y.
370+
proof. by rewrite &(contra) &(congr1). qed.
371+
372+
(* -------------------------------------------------------------------- *)
373+
lemma case_elim p q: ((p => q) /\ (!p => q)) <=> q.
374+
proof. by smt(). qed.
375+
368376
(* -------------------------------------------------------------------- *)
369377
lemma iffLR (a b : bool) : (a <=> b) => a => b by [].
370378
lemma iffRL (a b : bool) : (a <=> b) => b => a by [].
371379

372380
lemma iff_negb : forall b1 b2, (!b1 <=> !b2) <=> (b1 <=> b2) by [].
373381

382+
lemma iff_trans : transitive (<=>) by smt().
383+
374384
(* -------------------------------------------------------------------- *)
375385
lemma if_congr ['a] (e e' : bool) (c1 c2 c1' c2': 'a) :
376386
e = e' => c1 = c1' => c2 = c2'

0 commit comments

Comments
 (0)