(* * The Rocq Prover / The Rocq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* <O___,, * (see version control and CREDITS file for authors & dates) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************)
(* This file is (C) Copyright 2006-2015 Microsoft Corporation and Inria. *)
RequireImport ssreflect functions. p.1 == p.2 == second element These notations also apply to p : P /\ Q, via - Simplifying functions, beta-reduced by #[#fun : T => E#]# == constant function from type T that returns #[#fun x => E#]# == unary function
(** This file contains the basic definitions and notations for working with functions. The definitions provide for:
- Pair projections: p.1 == first element of a pair p.2 == second element of a pair These notations also apply to p : P /\ Q, via an and >-> pair coercion.
- Simplifying functions, beta-reduced by /= and simpl: #[#fun : T => E#]# == constant function from type T that returns E #[#fun x => E#]# == unary function #[#fun x : T => E#]# == unary function with explicit domain type #[#fun x y => E#]# == binary function #[#fun x y : T => E#]# == binary function with common domain type #[#fun (x : T) y => E#]# \ #[#fun (x : xT) (y : yT) => E#]# | == binary function with (some) explicit, #[#fun x (y : T) => E#]# / independent domain types for each argument
- Partial functions using option type: oapp f d ox == if ox is Some x returns f x, d otherwise odflt d ox == if ox is Some x returns x, d otherwise obind f ox == if ox is Some x returns f x, None otherwise omap f ox == if ox is Some x returns Some (f x), None otherwise olift f := Some \o f
- Singleton types: all_equal_to x0 == x0 is the only value in its type, so any such value can be rewritten to x0.
- A generic wrapper type: wrapped T == the inductive type with values Wrap x for x : T. unwrap w == the projection of w : wrapped T on T. wrap x == the canonical injection of x : T into wrapped T; it is equivalent to Wrap x, but is declared as a (default) Canonical Structure, which lets the Rocq HO unification automatically expand x into unwrap (wrap x). The delta reduction of wrap x to Wrap can be exploited to introduce controlled nondeterminism in Canonical Structure inference, as in the implementation of the mxdirect predicate in matrix.v.
- The empty type: void == a notation for the Empty_set type of the standard library. of_void T == the canonical injection void -> T.
- Sigma types: tag w == the i of w : {i : I & T i}. tagged w == the T i component of w : {i : I & T i}. Tagged T x == the {i : I & T i} with component x : T i. tag2 w == the i of w : {i : I & T i & U i}. tagged2 w == the T i component of w : {i : I & T i & U i}. tagged2' w == the U i component of w : {i : I & T i & U i}. Tagged2 T U x y == the {i : I & T i} with components x : T i and y : U i. sval u == the x of u : {x : T | P x}. s2val u == the x of u : {x : T | P x & Q x}. The properties of sval u, s2val u are given by lemmas svalP, s2valP, and s2valP'. We provide coercions sigT2 >-> sigT and sig2 >-> sig >-> sigT. A suite of lemmas (all_sig, ...) let us skolemize sig, sig2, sigT, sigT2 and pair, e.g., have /all_sig#[#f fP#]# (x : T): {y : U | P y} by ... yields an f : T -> U such that fP : forall x, P (f x). - Identity functions: id == NOTATION for the explicit identity function fun x => x. @id T == notation for the explicit identity at type T. idfun == an expression with a head constant, convertible to id; idfun x simplifies to x. @idfun T == the expression above, specialized to type T. phant_id x y == the function type phantom _ x -> phantom _ y. *** In addition to their casual use in functional programming, identity functions are often used to trigger static unification as part of the construction of dependent Records and Structures. For example, if we need a structure sT over a type T, we take as arguments T, sT, and a "dummy" function T -> sort sT: Definition foo T sT & T -> sort sT := ... We can avoid specifying sT directly by calling foo (@id T), or specify the call completely while still ensuring the consistency of T and sT, by calling @foo T sT idfun. The phant_id type allows us to extend this trick to non-Type canonical projections. It also allows us to sidestep dependent type constraints when building explicit records, e.g., given Record r := R {x; y : T(x)}. if we need to build an r from a given y0 while inferring some x0, such that y0 : T(x0), we pose Definition mk_r .. y .. (x := ...) y' & phant_id y y' := R x y'. Calling @mk_r .. y0 .. id will cause Rocq to use y' := y0, while checking the dependent type constraint y0 : T(x0).
- Extensional equality for functions and relations (i.e. functions of two arguments): f1 =1 f2 == f1 x is equal to f2 x for all x. f1 =1 f2 :> A == ... and f2 is explicitly typed. f1 =2 f2 == f1 x y is equal to f2 x y for all x y. f1 =2 f2 :> A == ... and f2 is explicitly typed.
- Composition for total and partial functions: f^~ y == function f with second argument specialised to y, i.e., fun x => f x y CAVEAT: conditional (non-maximal) implicit arguments of f are NOT inserted in this context @^~ x == application at x, i.e., fun f => f x #[#eta f#]# == the explicit eta-expansion of f, i.e., fun x => f x CAVEAT: conditional (non-maximal) implicit arguments of f are NOT inserted in this context. fun=> v := the constant function fun _ => v. f1 \o f2 == composition of f1 and f2. Note: (f1 \o f2) x simplifies to f1 (f2 x). f1 \; f2 == categorical composition of f1 and f2. This expands to to f2 \o f1 and (f1 \; f2) x simplifies to f2 (f1 x). pcomp f1 f2 == composition of partial functions f1 and f2.
- Properties of functions: injective f <-> f is injective. injective2 f <-> f(x,y) is injective. cancel f g <-> g is a left inverse of f / f is a right inverse of g. pcancel f g <-> g is a left inverse of f where g is partial. ocancel f g <-> g is a left inverse of f where f is partial. bijective f <-> f is bijective (has a left and right inverse). involutive f <-> f is involutive.
- Properties for operations. left_id e op <-> e is a left identity for op (e op x = x). right_id e op <-> e is a right identity for op (x op e = x). left_inverse e inv op <-> inv is a left inverse for op wrt identity e, i.e., (inv x) op x = e. right_inverse e inv op <-> inv is a right inverse for op wrt identity e i.e., x op (i x) = e. self_inverse e op <-> each x is its own op-inverse (x op x = e). idempotent_op op <-> op is idempotent for op (x op x = x). idempotent_fun f <-> f is idempotent (i.e., f \o f =1 f). associative op <-> op is associative, i.e., x op (y op z) = (x op y) op z. commutative op <-> op is commutative (x op y = y op x). left_commutative op <-> op is left commutative, i.e., x op (y op z) = y op (x op z). right_commutative op <-> op is right commutative, i.e., (x op y) op z = (x op z) op y. left_zero z op <-> z is a left zero for op (z op x = z). right_zero z op <-> z is a right zero for op (x op z = z). left_distributive op1 op2 <-> op1 distributes over op2 to the left: (x op2 y) op1 z = (x op1 z) op2 (y op1 z). right_distributive op1 op2 <-> op distributes over add to the right: x op1 (y op2 z) = (x op1 z) op2 (x op1 z). interchange op1 op2 <-> op1 and op2 satisfy an interchange law: (x op2 y) op1 (z op2 t) = (x op1 z) op2 (y op1 t). Note that interchange op op is a commutativity property. left_injective op <-> op is injective in its left argument: x op y = z op y -> x = z. right_injective op <-> op is injective in its right argument: x op y = x op z -> y = z. left_loop inv op <-> op, inv obey the inverse loop left axiom: (inv x) op (x op y) = y for all x, y, i.e., op (inv x) is always a left inverse of op x rev_left_loop inv op <-> op, inv obey the inverse loop reverse left axiom: x op ((inv x) op y) = y, for all x, y. right_loop inv op <-> op, inv obey the inverse loop right axiom: (x op y) op (inv y) = x for all x, y. rev_right_loop inv op <-> op, inv obey the inverse loop reverse right axiom: (x op (inv y)) op y = x for all x, y. Note that familiar "cancellation" identities like x + y - y = x or x - y + y = x are respectively instances of right_loop and rev_right_loop The corresponding lemmas will use the K and NK/VK suffixes, respectively.
- Morphisms for functions and relations: {morph f : x / a >-> r} <-> f is a morphism with respect to functions (fun x => a) and (fun x => r); if r == R#[#x#]#, this states that f a = R#[#f x#]# for all x. {morph f : x / a} <-> f is a morphism with respect to the function expression (fun x => a). This is shorthand for {morph f : x / a >-> a}; note that the two instances of a are often interpreted at different types. {morph f : x y / a >-> r} <-> f is a morphism with respect to functions (fun x y => a) and (fun x y => r). {morph f : x y / a} <-> f is a morphism with respect to the function expression (fun x y => a). {homo f : x / a >-> r} <-> f is a homomorphism with respect to the predicates (fun x => a) and (fun x => r); if r == R#[#x#]#, this states that a -> R#[#f x#]# for all x. {homo f : x / a} <-> f is a homomorphism with respect to the predicate expression (fun x => a). {homo f : x y / a >-> r} <-> f is a homomorphism with respect to the relations (fun x y => a) and (fun x y => r). {homo f : x y / a} <-> f is a homomorphism with respect to the relation expression (fun x y => a). {mono f : x / a >-> r} <-> f is monotone with respect to projectors (fun x => a) and (fun x => r); if r == R#[#x#]#, this states that R#[#f x#]# = a for all x. {mono f : x / a} <-> f is monotone with respect to the projector expression (fun x => a). {mono f : x y / a >-> r} <-> f is monotone with respect to relators (fun x y => a) and (fun x y => r). {mono f : x y / a} <-> f is monotone with respect to the relator expression (fun x y => a).
The file also contains some basic lemmas for the above concepts. Lemmas relative to cancellation laws use some abbreviated suffixes: K - a cancellation rule like esymK : cancel (@esym T x y) (@esym T y x). LR - a lemma moving an operation from the left hand side of a relation to the right hand side, like canLR: cancel g f -> x = g y -> f x = y. RL - a lemma moving an operation from the right to the left, e.g., canRL. Beware that the LR and RL orientations refer to an "apply" (back chaining) usage; when using the same lemmas with "have" or "move" (forward chaining)
the directions will be reversed!. **)
(** Parsing / printing declarations. *)
Reserved Notation"f ^~ y" (at level 10, y at level 8, no associativity,
format "f ^~ y").
Reserved Notation"@^~ x" (at level 10, x at level 8, no associativity,
format "@^~ x").
Reserved Notation"[ 'eta' f ]" (at level 0, format "[ 'eta' f ]").
Reserved Notation"'fun' => E" (at level 200, format "'fun' => E").
Reserved[ >"(t level0
format "'[hv' [ 'fun' : T => '/ ' E ] ']'").
Reserved " fun = E "( level
x name, format "'[hv' [ Reserved Notation "f ^ y"(at level 1
Reserved ['fun =E] at 0,
x name, format "'[hv' [ 'fun' format "@^~x".
Reserved "['fun' x =>E]" at0
x name, y name, format "'[hv' [ 'fun' x y => '/ ' E ] ']'"). Notationfun T> "(t level ,
x name, y
ReservedNotation[''(x: )> "( 0,
x , y nameformathv fun'( x T ) y => '/ ' E ] ']'").
Reserved Notation"[ 'fun' x ( y : T ) => E ]" (at level 0,
x name, y name, format "'[hv' [ 'fun' x ( y : T ) => '/ ' E ] ']'").
Reserved Notation"[ 'fun' ( x : T ) ( y : U Reserved Notation [ 'fun x => ] (atlevel0java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
x namename,formatfun )(y:U= ] )java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
Reserved Notation"f =1 g" (at level 70, no associativity) Notation xy:> ] ( level
next9
Reserved Notation" 'un' ( x : T )y=>E ]"](at level,
ReservedNotation" 2 g :> A" (atlevel 70, g at next, A at level0).
Reserved Notation"f \o g" (at level 50, format "f \o '/ ' g").
Reserved f \ g"( level 60 rightassociativity
format xnamey , format['['' y:T)= /' E ]'')java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
Reserved
, format {' > r})java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
Reserved Notation"{ 'morph' f : x / a }" (at level Notation 2 g at 70 no).
, format morph /a })java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
Reserved"morph'f a - "( ,at 9,
x name, y name, format "{ 'morph' f : x y / a >-> r }").
Reserved Notation"{ 'morph' f : x y / a }" (at level 0, f at level Notation" ; g"(at6,right
x name
Reserved "{'homo' f : x /a>- r }"( level at9,
x name, format "{ 'homo' f : x / a >-> r }").
Reserved " homo' f:x/a "(at 0, fat level9,
x name, format "{ ' Notation " '' f :x / "( level 0 atlevel99
Reserved" homo'f :x y /a>> r "( levelf at9,
x name, y name, format "{ 'homo' f : x y / a >-> r f at 99,
Reserved{'' f : x y /a "( level 0 fat level 99java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
,format' fjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 57
{ xy/ at 0 f at 99java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
x name, y name, format name " ' f : x / a })java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
Reserved {' f / - }level at9,
x name, format "{ 'mono' f : x / a >-> r }").
Reserved" mono :x a"(level 9
x Notation y/ at 0,at 99
Reserved{mono/ >" ,fat9
x name, y namenNotation' :y/}atat
Reserved Notation"{ 'monox name, format "{'' f:x/a - ".
x name, y name, format, "{'' f: ".
Reserved Notation"{ 'mono' f : x y /~ Notation {mono' -r}( , evel 9
xnameformat' / ".
Reserved Notation"@ 'id' T" (at level 10, T at level 8, format "@ 'id' T").
#="-closed-notation-not-level-0"]
Reserved Notation"@ 'sval'" (at, yname "{'ono f :xy / ".
(** Syntax for defining auxiliary recursive function. Usage: Section FooDefinition. Variables (g1 : T1) (g2 : T2). (globals) Fixoint foo_auxiliary (a3 : T3) ... := body, using #[#rec e3, ... #]# for recursive calls where " #[# 'rec' a3 , a4 , ... #]#" := foo_auxiliary. Definition foo x y .. := #[#rec e1, ... #]#. + proofs about foo
End FooDefinition. **)
Reserved Usage:
format "[Variables (g1 : T1) (g2 : T2). (globals)
Reserved Notation"[ 'rec' a , b ]" (at body, using #[#rec e3, ... #]# for recursive where" #[# 'rec' a3 , a4 , ... #]#" := Definition foo x y .. := #[#rec + proofs about End FooDefinition
format [rec"atlevel 0,
Reserved Notationformat' ".
[' a,b,c]".
Reserved Notation"[ 'recformat "[rec , ].
format "[ 'rec' a , b , c , d ]").
Reserved Notation"[ 'rec' a , b , c , d , e ]" (at level Notation" 'rec' a , b c , d ] (at level 0,
format 'rec , b, , d ,e])
Reserved Notation"[ 'rec' a , b , c , d , Reserved "[ 'rec' a,b , c d e]"(t level 0,
format['rec ,b,c, d ,e, f ])
Reserved NotationNotation" rec a ,b c , ,f ] at level 0,
format "[ 'rec' a , b , c , d , e , f , g ]")
Reserved Notation" 'rec a , b ,c,d , ,h] (level0,
format "[ 'rec' a , b , c , d , e , f , g , h ]").
Reserved Notation"[ 'rec' a , b , c , d , e , f Reserved Notation "rec ,,e ](0
format',b , ".
Reserved ' , "
[rec,c, ,f, "
Definition all_pair I T U (w : forall i : I, T i * U i) :java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(fun i => (w i).1, fun java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
(** Complements on the option type constructor, used below to
encode partial functions. **)
Notation erefl := :=. Notation ecast i T e x := (let: erefl congr2:f_equal2 Definition esym := sym_eq. Definition nesym Implicits nesym Definition etrans := trans_eq. Definition congr1 := f_equal. Definitionual2. (** Force at least one implicit when used as a view. **)
Prenex esym.
(** A predicate for singleton types. **) Definition all_equal_to T (x0
Lemma unitE wrapped { :java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
(** A generic wrapper type **)
#[universesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
wrapped {unwrap .
Canonical wrap " =( =f x:java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
Prenex Implicits unwrap wrap Wrap i.e., which
DelimitScope
pen.
** Notations for argument transpose **) Notation"f ^~ y" := (fun x => f Notation" rT :.
(** Definitions and notation for explicit functions with simplification,
i.e., which simpl and /= beta expand (this is complementary to nosimpl). **)
# [ 'un = " java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 78
Variant simpl_fun fun >": ( >[ >):function_scopejava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
Section.
Variables aT rT : Type.
Definition "[ 'fun' ()y=> E ]: fun = fun >E]
End SimplFun.
Coercion fun_of_simpl : simpl_fun >- parsing.
NotationNotation parsing. Notation Notation" fun x = "=(fun = fun = E):function_scope Notation SimplFunDelta rTf - aT ) :[fun >f zz]
(only parsing Notation"[ Extensional equality, for unary and binary functions, including syntactic
sugar. Notation"[ 'fun' ( xSection ExtensionalEquality.
(only parsing A B . Notation"[ 'fun' x ( y : T ) =>
(only) : . Notation"[ 'fun' ( x java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
only parsingparsing :function_scope
(** For delta functions in eqtype.v. **) Definition SimplFunDeltajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(** Extensional equality, for unary and binary functions, including syntactic
sugar. **)
Section ExtensionalEquality.
VariablesBC :Type.
Definition (f g : B -> A) : Prop := forall x, f x = g x.
Definition eqrel (r s : C -> B -> A) : Prop := forall x y, r x y = s x y.
Lemmafrefl:eqfunff.Proof [] . Lemma fsym f g : eqfun
Notation". Notation"f1 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Notation" =2 " : ( f1f2:. Notation"f1 =2 f2 :> A" := mp fgjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
Section Composition.
Variables C :Type
Definitioncompf:B-A ( - ) x: f gx. Definition catcomp Definition pcomp: B->optionA g C >optionx :obind )
Lemma compB C} f g x /java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
. move' eq_ggrewrite eq_gg'Qed
End
Arguments comp {A B C} f g x /. Arguments catcomp {A B C} g ff \ g\o h) =( \g \ h. Notation"f1\o f2" =(comp f1f2 : function_scope Notation"f1 \; f2" := (catcomp f1 f2) : function_scope.
Lemma ABCD:Type B - A g:C - B)( :>)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
f \o (g \o h) = (f \o g) \o h.
. [.Qed
Lemma omapEbind : omap f = obind (olift f). Proof. by []. Qed.
Lemma omap_id (
Lemma . by Proof. byjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Lemma : (g\ )= g \o f. Proof ] .
Lemma oappEmap (y0 :Lemma x : oappg \) 1(oapp _ _)^ g\ f. Proof : .Qed
Lemma : (g of)= omapoomap Proof. by. bycaseQedjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0 Proof. bycase(
Lemma oapp_comp_f (x : rT Proof. bycase. Qed.
Lemma olift_comp : olift (g \o f) = olift g \ Proof. by []. Qed.
End OptionTheory.
(** The empty type. **)
Notation :=Empty_setjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
T ( ) : T : match end
(** Strong sigma types. **)' (tag2 let _ _ y :=win
Section Tag.
Variables
Definition tag := projT1. Definitiontagged w,T_( w) : projT2 eta. Definition Tagged x := @existT I [eta T_] i x.
ion tag2( :@sigT2 I T_) : : existT2 _:=w in Definition java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Definition tagged2' w :Tagged i= T_ *U_i)%ype( w,' w. Definition Tagged2 x y := @existT2 I [eta T_] [eta U_]
Coercion tag_of_tag2 I T_ U_ (w : @sigT2 I T_ Proof. by move=> fP; exists (fun x => tag (fP x); case: (fP x). Qed
TaggedLemma all_tag2 I T U V :
Lemmaall_tagI TU:
(forall x : I, {y : T x & U x y}) ->
{f : forall x, T x & forall x, U x (f x)}. Proof. by move=> fP; exists (fun x => tag (fP x)) => {f: forall i, T i& foralli,Ui( )&forall, V i (i).
Lemma all_tag2 I T U V :
(orall i : I y:T i&U i y &Vi y} -
{f : java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Proof=f/[]; f .
Lemma svalP (u : sig P) :Lemma s2valP u : (s2val . bycase u.Qed
Definition (u : sig2): let: exist2x =u x.
Lemma s2valP u : P (s2val u). Proof. by Sig
Lemma' u : Q (2 u). Proof. bycase u.Qed
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
Prenex Implicits exist (un i = Pi/ i) ( u) (conj (s2valP (s2valP).
Coercion tag_of_sig I P (u forall ,{:T |Px}) ->
Coercion sig_of_sig2 I P Q. by/=> f;exists f.Qed exist (fun i => Lemma all_sig2 I T
Lemma all_sig fforallx x ( x Q x f x}
( x ,y:Tx|P } -
{f : forall x, T x | forall x, P x (f x)}. Proof. bycase/all_tag=> f; exists f. Qed.
Lemma all_sig2 I T P Q :
(forall x : I, {y : T x | java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
{f : forall x, T x | forall x, P x (f x) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Proof. bycase/all_sig=> f /all_pair[]; exists f. Qed.
Section Morphism.
Variables (aT rT sT : Type) (f : aT -> rT).
unary and functions*java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 Definition morphism_1 aF rF := forall x, f (aF x) = rF (f Definitionhomomorphism_1 rP -) :=forallx aP- rP x. Definition homomorphism_2aR :> ) =
(** Homomorphism property for unary and binary relations **) Definition( _>): x > (). Definition homomorphism_2 (aR rR : _ -> _ -> Prop) :=
xy aRxy ->rR x)( y.
(** Stability property for unary and binary relations **))fy x yjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 Definition monomorphism_1 (aP rP : _ -> sT) := forall. Definition monomorphism_2 (aR rR : _ ->(orphism_1fun>)( x >a) : type_scope
x y, fx)( )=aR.
End.
Notation"{ 'morph' f : x / a >-> r }" :=
(morphism_1 f (fun x = " ' f:x/a>-r} :
{ java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 35
( f( x = )(un a):type_scope Notation"{ 'morph' f : x y / a >-> r }" :=
m funy=>a) fun y= r) Notation'orph y ":
( f funy= a fun xy >) type_scope Notation{homo >>r } =
(homomorphism_1 f (fun x => a "{ '' f :x y/ ": Notation"{ 'homo' f : x / a }" :=
(homomorphism_1 f (fun"{ mono' f : ->r}"=
(monomorphism_1x=>)(fun=>) type_scope.
(homomorphism_2 f (fun x y => " mono' f : x } : Notation"{ 'homo' f : x y / a }" :=
(homomorphism_2 f (fun x y => a) (fun x y => a)) : type_scope. Notation"{ 'homo' f : x y /~ a }" :=
(homomorphism_2(fun y >)(fun =>a) type_scope Notation"{ 'mono' f : x / a "{'mono y/a ":
:type_scope Notation"{ 'mono' f : x / a }" :=
(monomorphism_1 f (fun x => a) (fun x => a)) : f fun =a funy =a) . Notation"{ 'mono' f :
(monomorphism_2 (fun y=> a) fun x y=>r) : type_scope. Notation" 'mono' f :x y / }":=
(monomorphism_2 f(fun x y=> a ( x y = a) : type_scope Notation"{ 'mono' f : x y /~ a }" :=
(monomorphism_2 funy x = a)(fun x y=>a)) :type_scope
(** In an intuitionistic setting, we have two degrees of injectivity. The weaker one gives only simplification, and the strong one provides a left inverse (we show in `fintype' that they coincide for finite types). We also define an intermediate version where the left inverse is only a
partial function. **)
Section Injections.
Variables (rT aT : Type) (f : aT -> rT).
Definition injective := forall x1 x2, f x1 = f x2 -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Definition cancel g := forall xDefinition := forall x1, f x1f x2>x1 x2
Definition pcancel=forall,g( )= x.
Definition ocancelDefinition g :forallx f) x.
Lemmacan_pcan :cancel- pcancelfuny = Some) Proof. by move=> fK xjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pcan_injg pcancel -injective Proof. by move=> fK x y /(
Lemma can_inj g : cancelProof.by move=> fK x y /(congr1 g); rewrite !fK => [[]]. Qed. Proof. by move/can_pcan; apply: pcan_inj. Qed.
Lemma g x y cancel g -> =f y ->gx=y. Proof. by move=> fK ->. Qed.
Lemma canRL g x y : cancel g -> f x = y -> x = g y. Proof movefK<.Qed
Lemma Some_inj {T : nonPropType} : injective (@Some T). Proof. by move=> x y []. Qed.
Lemma inj_omap {aT rT : Type} (f : aT (Some
injective f -> injective (omap f). Proof. by move=> injf [?|] [?|] //= [/injf->]. inj_omap rTType f: - ) :
emma aT } ( - ) g: - ) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
fg- ( f) g)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 Proof. by
Lemma. by. . Proof. bycase. Qed.
(** cancellation lemmas for dependent type casts. **) Lemma Tx : (@esym) (@ T y). Proof. bycase: y /. Qed.
Lemma etrans_id T x y (eqxy : x = y :> T) Proof. : y /eqxy.
Section InjectionsTheory.. case /eqxy Qed
Variables (A B C : Type) (f
Lemma inj_id :java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Proof. by []. . by [] Qed.
Lemma inj_can_sym f' : cancel Proof move= fK' x;applyinjf' Qed
Lemma inj_comp Proof inj_comp: f ->injective>injective(f\ )
Lemma inj_compr : injective (f \o h) -> Proof move x y /( f) /injfh Qed.
Lemma f' h cancelf f'>cancel h' - (f \ ) h \ f)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80 Proof => fKhK x;rewrite hK Qed.
Lemma f' h
pcancel f f' -> pcancel h h' -> java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0 Proof move>fK hK /pcomp / . Qed
Lemma ocan_comp [fo : B -> option A] [ho : C -> option B]
> B] [h' B ->C]:
ocancel fo f' -> ocancel ho h' -> ocancel (obind fo \o ho) (h' \o fjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Proof.
move' :A -B h B- C] : byrewrite -[b in Qed.
Lemma eq_inj : injective f -> f =1 g -> injective g.
.= x; -!qfg . Qed
Lemma eq_can f' g' : cancel. Proof. by eq_injinjective f = g >injective .
Lemma inj_can_eq f' : cancel f f' -> injective f' -> cancel g f' -> f =1 g. Proof.bymove>fKinjf x; apply injf' rewrite fKQed.
End Lemma eq_can f' f' f f - f =g -f = g'- cancelg'java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
Sectionjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
Variables (A B : Type
Variant bijective : .
Hypothesis bijf : bijective.
Lemma bij_injinjective Proof
Lemma f f' f <>cancelf f' Proof. split=> fK; first exact: inj_can_sym fK bij_inj. bycase: bijf => h _ hK x; rewrite -[x]hK fK. Qed
Lemma bij_can_eq f' f'' : cancel f java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Proof. by => fKfKapply (inj_can_eq ); /bij_can_sym Qed.
End Bijections.
Section BijectionsTheory.
Variables (A B C : Type) Variables ( C:Type -A h C - )
Lemma .= fg; f; eq_can.Qed Proof. by bij_comp f - h > (f\ h)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
Lemma bij_comp : bijective f -> bijective h -> bijective (f \o h). Proof. by movef' f'][h'hK'] ('\ '; apply ; auto Qed.Proof=> ; exists; byapplybij_can_sym). Qed
Lemma inv_inj : java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Lemma inv_bij : bijective f. Proof. byexists f.
End.
Section.
Variables R:Type.
Section SopTisR.
ype : - -Rjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 Definition left_inverse e inv SopTisR Definition right_inverse e inv op := forall x,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 Definition op forall,injective(opx. Definition right_injective op := right_id : x,op =x. EndDefinitionleft_zeroz op =forall,opx =.
Section . ImplicitType op : S -> T -> S. Definition right_id x y) z =add x z opz) Definition z op forallx z x . Definition right_commutative op := forall x y z, op (op x y) z = op (op x z) y. Definition left_distributive op add := forall x y z, op (add x y) z = add (op x z) (op y z). Definition right_loop Definition rev_right_loopinv := forally, cancelop(inv y))(p~y. End SopTisS.
Section SopTisT. ImplicitType op : S -> T -> T. Definition e op=forallx,java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 Definition right_zero z op := forall x, op x z = z. Definition left_commutativeop: forall x y z, opx (op y z) = op (op z) Definition right_distributive op add := forallx yz x ( y z)=add x y)(opz. Definition left_loop inv op := forall x, cancel (op left_loop op:forall,cancel( x) op x)). Definition rev_left_loop inv op := forall x, cancel (op (inv x)) (op x). EndSopTisT
Section SopSisT. ImplicitType op : SSection SopSisT
java.lang.StringIndexOutOfBoundsException: Range [26, 10) out of bounds for length 53 Definition op : forall,opy=op. End SopSisT.
Section. ImplicitType op. Definition idempotent_op op := SopSisS Definition associative op := forall x y z, op x (
interchange op2 forall x y z t, op1 (op2 x y) (op2 z t) = op2 (op1 x z) (op1 y t). forall y zt (op2y)( z t)= op2 x z)( )
End OperationProperties
[(="" =idempotent_op Notation idempotent:= java.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 0
Definition (U ) (f:U -): f of= .
Lemma inr_inj {A B} : injective (@java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 0
Lemma inl_inj {A B} : injective (@inl A B). Proof. by move=> ? ? []. Qed.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.